Visual Installer: If a specific version of .NET Framework is missing

We have improved Visual Installer’s behaviour in situations where a required version of Microsoft .NET Framework is missing in a computer. Before you could choose between stop the installation or warn the user if a specific version of .NET Framework was missing in the end-userĀ“s computer. But now you can also let the end-user download the missing version of .NET Framework from the Internet and install it. Or, if you distribute .NET Framework with your software, you can start an installation of Microsoft .NET Framework directly from Visual Installer.

This was partially possible already in earlier versions of Visual Installer / Professional using script commands, but now this can be done without script. You can choose if you want this behaviour by selecting an option in Visual Installer’s editor.

How it works
If Visual Installer discovers during the installation of your software that the required version of Microsoft .NET Framework is missing, a mini wizard is started. The mini wizard will help the end-user to start an installation of .NET Framework. Visual Installer pauses the installation until .NET Framework is installed. The pictures below show an example of how it may look like:

Step 1 – Initial information
Step 1

Step 2 – Download information
Step 2

Step 3 – Information about how to continue
Step 3

Where to find this new functionality?
You can turn on and off this new functionality by opening the SpecialSetup options menu item and opening the .NET tab:

Setup Options - .NET

In the .NET tab you will find a new option named Download and install .NET Framework. If you select this option, the new behaviour will be invoked if the required version of .NET is missing in the end-user’s computer. If you click on the Options button, you can set some options for this new function. You can for example specify your own download page if you don’t want to use the default download page at Microsoft’s website. You can also specify a language for the download page.

See also
> Visual Installer: More available versions of .NET Framework
> Tip: How to prevent an installation if wrong .NET version

Visual Installer: More available versions of .NET Framework

We have increased the list of available versions of .NET Framework in Visual Installer to also include sub versions of .NET Framework, for example version 4.5.1, 4.5.2 etc. The picture below shows which versions of .NET Framework that Visual Installer currently supports:

More available versions of .NET Framework

Also the scripting language in Visual Installer have been extended to support the above versions.

You can use this functionality, for example, to install a missing version of .NET Framework or to run different tools depending of which versions of .NET Framework that are installed.

Available in Visual Installer 2015 version 10.5.15 and later
The extended list of supported .NET versions is available in Visual Installer 2015 version 10.5.15 and later. If you have an active 1 or 12 months maintenance plan for Visual Installer 2015, you can download this update for free from our download page.

See also
> Visual Installer: If a specific version of .NET Framework is missing

New setup dialog box in Visual Installer: User Options

We have added a new setup dialog box to the Professional version of Visual Installer. The name of the dialog box is User Options and it is a general dialog box where the user can select and unselect options that you add to the setup project. These options co-operates with conditional statements in Visual Installer’s scripting language and with Visual Installer’s Registry tab. Below is an example of how the User Options setup dialog box may look like and how it can be used:

In the example above we have added three options to the setup dialog box. The user can select and unselect the options of his/her choice.

To activate this dialog box, you need first open the Dialog boxes tab in Visual Installer’s editor and check the User options option:

Then you can click on the button marked “…” to the right of the option. This will open a new dialog box in the Visual Installer editor with the title User Options. Below we have filled the dialog box with the text and options that is needed to create the setup dialog box in the example above:

As you see, it is very easy to create a setup dialog box with your own options. You just need to enter a title, a short description text and your options. And it is done!

Co-operates with Visual Installer’s scripting language and ‘Registry’ tab
The main purpose of this new option dialog box is to let the end-user decide which script lines to execute and which keys and values to add to the Registry, during the setup process. This is a more flexible way to handle user choices than file components (file groups) because you don’t necessary need to copy files based on user choices; instead you can use Visual Installer’s whole scripting language to do whatever you want. This is useful if some special operations must be done, based on user choices.

Below we show how Visual Installer’s scripting language can co-operate with the User Options dialog box:

And below we show how the Registry tab in Visual Installer can co-operate with the User Options dialog box:

Scripting language
In Visual Installer’s scripting language we have added a new condition check, IF OPTION(n), that can be used to check which options the user has selected in the User Options setup dialog box. We have added a similar condition check to Visual Installer’s Registry tab: IF_OPTION(n).

The IF OPTION(n) condition in the script language can check both if an option is ON (selected) or OFF (unselected). So for example to examine if option 2 was selected by the end-user, you can enter the following condition:

IF OPTION(2)=ON

END IF

If you for example need to examine if option 3 was not selected, you can enter the following condition:

IF OPTION(3)=OFF

END IF

‘Registry’ tab
The condition check in the Registry tab works in a similar way. IF_OPTION(n) or IF_OPTION(n)=ON can be used to examine if an option was selected by the end-user. IF_OPTION(n)=OFF can be used to check if an option was not selected.

If you use IF_OPTION(n) and the option number n was selected by the end-user, the key or value will be added to the registry. The example below shows how to examine if option number 1 is selected, and if yes, add a value to registry:

See also
> Tip: How to use the ‘User Options’ dialog box with script

Visual Installer’s scripting language now supports ELSE

SamLogic Visual Installer LogotypeWe have updated Visual Installer’s built-in scripting language so it now supports an ELSE statement. This will help creating simpler scripts in some situations.

For example, assume that you want to run a particular and specialized application or setup program in a specific version of Windows, and a general application or setup program in all other versions of Windows. Before you needed to cover all Windows version with IF statements and OS checks, but now you only need to check for one OS, and add an ELSE statement to cover the rest. Example:

Example how to use ELSE

With the SETENV command you can set environment variables from Visual Installer

In this blog post we explained how to use Windows’ environment variables in Visual Installer; for example as a part of a file path. You can also create or change values for environment variables in the system during an installation by using a script command in Visual Installer’s scripting language. The name of the command is SETENV and you can use this command to set an environment variable to a specific value. If the environment variable does not exists, it will be created. If it already exists, its value will be updated.

Examples of usage
The example below shows how to use the SETENV command to set an environment variable with the variable name MyVariable to the value MyValue:

// Example 1: Set MyVariable = MyValue
SETENV MyVariable, MyValue

You can also use Visual Installer’s variables (for example %DESTDIR) when you set values. The example below shows how to set an environment variable with the variable name MyAppsFolder to the path %DESTDIR\MyApps:

// Example 2: Set MyAppsFolder = %DESTDIR\MyApps
SETENV MyAppsFolder, %DESTDIR\MyApps

The picture below shows same examples in Visual Installer’s scripting editor:

Easier to register a type library for a .NET assembly (in Visual Installer)

In the previous version of Visual Installer we added a function that makes it possible to register a .NET assembly. In Visual Installer 2015 (version 10.5.5 and newer) we have extended this functionality so you also can create and register a type library for the .NET assembly.

We have added a new /tlb option to the Register .NET Assembly dialog box. You can see the new option to the right in the Parameters frame in the screen dump below:

If you select this option, a type library will be created in the same folder as the .NET assembly. The type library will have the same filename as the assembly (the .DLL file), but with a .TLB filename extension. For example, if the filename of the DLL is MyFile.DLL, the filename of the type library will be MyFile.TLB.

The type library will be automatically registered after creation.

See also
> Tip: How to register a .NET assembly

Using environment variables in Visual Installer

It is possible to use Windows environment variables in Visual Installer. The environment variables can be used in the Registry tab and in the INI files tab in Visual Installer. You can find a list of supported environment variables in this Wikipedia page (see the Windows section).

You use an environment variable in the same way as a Visual Installer variable. For example, to include the %ProgramFiles% environment variable in a file path you can include it like this:

%ProgramFiles%\SamLogic\Visual Installer

And during the installation the %ProgramFiles% variable will be replaced with the current value that the system returns (usually C:\Program Files (x86)).

The picture below shows how to use the %COMPUTERNAME% environment variable in the Registry tab in Visual Installer:

During the installation the %COMPUTERNAME% variable will be replaced with the current computer name of the computer.

See also
> With the SETENV command you can set environment variables from Visual Installer

How to add more files from a previously used folder (Visual Installer)

I guess that you sometimes are in the situation that you need to add more files from the same source folder as some of the files that already are included in your project. But to get there you need to browse through many folders on your hard disk which may take some time.

To simplify and speed up this process we have added a new menu item to the local (right-click) menu in the File list tab in Visual Installer. The name of menu item is Add more files from same source folder and the picture below shows where in the menu to find the new choice.

If you right-click on a file in Visual Installer’s file list and thereafter choose the Add more files from same source folder menu item, the Add files dialog box in Visual Installer will be opened with the files in the same source folder as the selected file listed.

For example, if you right-click on a file in Visual Installer’s file list which source folder is C:\My Pictures\My Second Project, this folder will automatically be chosen and the files in this folder will be automatically listed in the Add files dialog box (see the picture below). And you can easily add more files from the same folder to the file list.

See also
> How to view source paths in the file list in Visual Installer

Visual Installer can now import Visual Studio solution files

We have improved Visual Installer’s ability to co-operate with Microsoft Visual Studio. Since many years Visual Installer has been able to import Visual Studio / Visual Basic project files (.vbproj), but starting with Visual Installer 2015 also solution files (.sln) can be imported.

This is very useful if you have a solution that contains many projects. If you choose to import a solution file, Visual Installer will analyze all projects in the solution and import the necessary files.

How to import a Visual Studio solution file
If you want to import a Visual Studio solution file to Visual Installer you can choose the Import Visual Basic project — Visual Basic .NET 2005-2015 project menu item in the File menu in Visual Installer’s editor:

Thereafter you click on the Select project file button in the dialog box that is shown:

As default, project files (.vbproj files) are filtered out in the Open dialog box that is shown, but to the right in the Open dialog box you can choose solution files (.sln files) instead:

Now you can choose a Visual Studio solution file to import.

See also
We have published a step-by-step tip on our website that shows in detail how to import a Visual Basic project or solution to Visual Installer. There is also a tip video available.

> Tip: How to create an installation for a VB.NET application

Build a setup package or menu interface silently using a batch file

With Visual Installer 2015 and CD-Menu Creator 2015 it is possible to build a setup package and a menu interface silently, without any interaction with a graphical user interface. The build process is invisible, and you use command line parameters and switches to handle the build operations. And errors that occur (if there are any) are returned via a log file that contain detailed error descriptions and error codes etc.

Build servers
The silent build processes via command line parameters / switches makes it easy to call Visual Installer 2015 and CD-Menu Creator 2015 from build servers. A build server is useful if you work in a team and your team want to, for example, compile applications, build setup packages and (perhaps) build menu interfaces in one operation.

Batch files
You can also utilize this new function from local batch files (for example from traditional .BAT files). You can add one line of code for each setup package or menu interface that you want to build, in the batch file. For example:

VI.exe C:\MyProjects\MySetup.vip /BUILD /BUILDFOLDER:C:\MyCreatedSetups\Setup1

More information
We have added two detailed tips on our website that describes how to use this new function in Visual Installer 2015 and CD-Menu Creator 2015:

> Tip: Visual Installer’s command line parameters
> Tip: CD-Menu Creator’s command line parameters