Windows Installer Bootstrapper

The software is provided "AS IS" without any warranty, either expressed or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. The author will not be liable for any special, incidental, consequential or indirect damages due to loss of data or any other reason.

Why using a MSI-bootstrapper ?

  • Managing program dependencies is hard, at least harder than other non-MSI based installers. Using InnoSetup, you can for instance launch the Visual C++ runtime installer during the process (not before or after, but as a part of the installation). Such thing cannot be done with MSI-based installers since nested installations aren’t supported. You have to "chain" the installers, but in this case you need to use a program to run sequentially each setup program.
  • In most cases, MSI setups needs to run elevated under Vista and higher. If the user does not run an elevated shell, the setup might fail miserably executing your custom actions. You can use some MSI directives to check if the setup is running with elevated privileges, but anyway it's quite hard for the average user to run a .msi file elevated.

My boostrapper (called WiB) solves these two points :

  • It asks the user for elevation using a custom manifest in the executable binary.
  • Using a simple configuration file, it allows the developer to chain the setup programs for the prerequisites and the application MSI with a nice user interface (at least, from my point of view).

It can be used in conjunction with IEXPRESS.EXE, to compress the bootstrapper, the setup programs, and the configuration file to a single binary file.

How does it work ?

The boostrapper reads on startup a configuration file which must be named <EXENAME>.inf and placed in the same directory. For instance, if you named the binary file "setup.exe", you have to create the text file "setup.inf" alongside of the bootstrapper.

The program does NOT rely on any external runtime (Visual C++, .NET framework, etc.) so it can be started before any installer during your setup process.

The program handles both non-MSI installers (regular EXE files launched through ShellExecuteEx) and MSI installers (started using msiexec /i).

The user interface

I used Office 2007/2010 installer as reference. It displays a nice single window with reduced user input, creating a smooth user experience :


The bootstrapper program displays 4 different dialogs :

  • The Welcome Page, used to display the welcome message. This page can be hidden in the configuration file.
  • The Select Components page, if the user is allowed to customize the list of prerequisites to install. This page can be hidden in the configuration file.
  • The Install Components page, displayed while the user installs the prerequisites. This page can't be hidden since it serves as background window, asking for the user to wait during the installation.
  • The Installation finished page, displayed when all the setup files have been launched.

Building the configuration file

Global overview

The configuration file is build like any INI/INF file : instructions are divided into Sections, and are compounded of Names and Values. For instance, the following code sets the variable "SetupSettings.AppName" to "FooBar" :

[SetupSettings] AppName=Foo Bar

There is 3 pre-defined sections :

  • [SetupSettings] stores the bootstrappers global settings,
  • [Graphics] stores the graphics settings.
  • [ResourceStrings] stores all the texts displayed by the application.

Then you must add a new section for each installer you've to run. The section name must begins with the character "$" and has to be followed by the relative path to the .exe/.msi file to launch. For instance, [$setup_data\vcredist08_x86.exe] will gather all the parameters needed to run properly the VC++ x86 runtime installer named "vcredist08_x86.exe" stored in the directory ".\setup_data". The setup files will be executed in the order the sections are read.

The global settings

The following directives must be incorporated in the [SetupSettings] section :

  • AppName=appname. The application name, using in the title bar and in the task manager.
  • WelcomePage=no, yes (default). Should we display the Welcome Page ?
  • SelectComponentsPage=yes, no (default). Should we display the page allowing to select the components to be installed ?
  • InstallFinishedPage=no, yes (default). Should we display the Install Finished Page ?

The graphics settings

The following directives must be incorporated in the [Graphics] section :

  • HeaderImage=relative_path. Relative path to the header image.
  • BackgroundImage=Relative path to the background image.
  • TextFontName=font. You can force a font to be selected, if nothing is specified the default dialog will be used.
  • TextFontSize=size. You can force a specific font size, if nothing is specified the default font size will be used.
  • TextFontColor=color. You can force a specific font color, if nothing is specified the default font color will be used.

Texts and translation

The following directives must be incorporated in the [ResourceStrings] section :

  • AbortInstallation=... The text displayed in the warning dialog when the user try to close the bootstrapper windows before the end of the installation.
  • WelcomeText=... The text displayed in the Welcome Page.
  • InstallationFinishedText=... The text displayed in the Installation Finished page.
  • ContinueButton=... The text for the button launching the setup files.
  • CloseButton=... The text for the "Close" button.
  • InstallButton=... The text for the "Install" button.
  • RunError=... The text displayed when an unexpected error occurs while running a prerequisite.
  • HasNotAdminRights=... The text displayed when the bootstrapper is not launched with the admin rights.
  • ChooseComponentsText=... If the Select Components page is enabled, the text displayed on the top of the list of the components.
  • InstallText=... The text displayed during the installation.
  • InstallComponent =... The text displayed during the installation (on the top of the name of the current prerequisite).

Adding your setup files

Add a new section for each MSI/EXE file to install. The following directives can be used to control how the prerequisites are launched :

  • Parameters=cmdline (default : empty string). The command line to send to the prerequisite.
  • Platform = 32bit, 64bit, all (default). Define the platform required to run the prerequisite.
  • ProcArch = x86, x64, ia64, all (default). Define the processor architecture needed to run the prerequisite.
  • MinVersion = Major.Minor. A minimum Windows NT version for the prerequisite to be processed.
  • OnlyBelowVersion = Major.Minor. Specifies the minimum Windows NT version for the prerequisite not to be processed.
  • BootstrapperCmdLine=substitute,merge,ignore (default). Is the command line used to start the bootstrapper also dispatched to the prerequisite ? If you use "substitute", the non-empty command line is used instead of the command line specified through the "Parameters" directive. If you use "merge", the command line specified by "Parameters" is concatenated with the parameters received by the application. If you use "ignore", the bootstrapers command line is never used.
  • Caption=caption. The text displaying in the UI while running the prerequisite.
  • RunHidden=yes, no (default). If true, the prerequisite is run hidden.
  • RunAsync=yes, no (default). If true, the end of the setup program is not waiting before processing the next entry.

The following parameters can be used if Select Components page is used :

  • SelectState=selected, notselected, notunselectable (default). Set the selection state for the component : selected => the component can be selected, and is included by default (the checkbox is checked), notselected => the component can be selected, and is NOT included by default (the checkbox is unckecked), notunselectable => the composant is selected by default and cannot be unselected by the user.
  • Visible=no, yes (default). Define if the component is selected in the Select Component list.
  • DisplayInBold=yes, no (default). Define if the line for the component in the Select Component list is displayed in bold.
  • DisplayGrayed=yes, no (default). Define if the line for the component in the Select Component list is displayed grayed.
  • DisplayInItalic=yes, no (default). Define if the line for the component in the Select Component list is displayed in italic.
  • DisplayUnderline=yes, no (default). Define if the line for the component in the Select Component list is displayed in underline.

Windows versions

The following version numbers can be used for MinVersion and OnlyBelowVersion directives :

  • 5.0 : Windows 2000
  • 5.1 : Windows XP / Windows XP 64-Bit Edition Version 2002 (Itanium)
  • 5.2 : Windows Server 2003 / Windows XP 64-Bit Edition Version 2003 (Itanium)
  • 6.0 : Windows Vista / Windows Server 2008
  • 6.1 : Windows 7 / Windows Server 2008

Sample Wib.inf configuration file

The following file is used to deploy UltraBackup NetStation 3. The application requires MSVC++ runtimes, which comes in 2 flavours : for 32 bit platforms (vcredist08_x86.exe) and for 64 bit platforms (vcredist08_x64.exe). This file tells the bootstrapper to run in quiet mode (/q:a) the appropriate VC++ runtime, then launch the application installer (nsclient.msi).

[SetupSettings] AppName=Astase UltraBackup NetStation 3 WelcomePage=yes AdminRightsRequired=yes InstallFinishedPage=no SelectComponentsPage=no [ResourceStrings] InstallButton=&Installer ContinueButton=&Continuer CloseButton=&Fermer WelcomeText=Bienvenue dans le programme d'installation de UltraBackup NetStation (Client).\n\nCe programme va installer les composants requis pour le programme. Cliquez sur "Continuer" pour démarrer l'installation. ChooseComponentsText=Cochez les composants à installer : AbortInstallation=Etes vous sûr de vouloir quitter ?|Si vous quittez maintenant, le programme ne sera pas installé.\n\nQuitter ? InstallText=Les composants sont en cours d'installation. Ne terminez pas cette application avant la fin de l'opération. InstallComponent=Installation du composant : InstallationFinishedText=Le logiciel a été installé.\n\nMerci d'avoir installé Astase UltraBackup NetStation 3. Pour utiliser un programme UltraBackup, ouvrez le menu Démarrer, localisez le dossier UltraBackup NetStation, et cliquez sur l'icône du programme. RunError=Erreur d'exécution. Continuer ?|Le programme dinstallation na pas pu être exécuter. Continuer ? HasNotAdminRights=Impossible de continuer car vous ne possédez pas assez de droits. [$vcredist08_x64.exe] Parameters=/q:a Platform=64bit Caption=MSVC++ 8.0 Redistributable package (64 bit) [$vcredist08_x86.exe] Platform=32bit Parameters=/q:a Caption=MSVC++ 8.0 Redistributable package (32 bit) [$nsclient.msi] Caption=Client de sauvegarde [Graphics] HeaderImage=bt_hdr.png BackgroundImage=bt_bg.png Another sample configuration file is also included in the file archive.

Use & Download

Required configuration : Windows 2000 or higher. Both 32 bit and 64 bit systems are supported. This program does not run under Windows 95, Windows 98, or Windows Me. No specific runtime is needed to run the bootstrapper.

WiB can be used freely with your programs. Please remember that you’re not allowed to remove the copyrights inserted in the binary file (shown by Windows Explorer in the “Properties” window).

To reduce the size of the bootstrapper, you can pack the file using EXE compressors like UPX. Nevertheless, keep in mind that packed executables are sometimes detected as malicious files by some antivirus programs.

It is recommended to sign the bootstrapper using your code signing certificates, in order to have a more friendly elevation warning dialog.

Download Windows Installer Bootstrapper (WiB)