Multilingual bootstrapper is the very first piece of code that is executed after user runs setup package. This article will describe bootstrapper's responsibilities, design and relation to other parts of SharpSetup installer. It will also describe how bootstrapper can be configured, translated and extended.

In general bootstrappers have several responsibilities. These include:

  • unpacking files such as MSI package (WiX based), cabinet files, SharpSetup library, main gui and other support files,
  • allowing user to choose language of the installation,
  • checking for and optionally installing core prerequsities of the main installation process,
  • cleaning up temporary files after installation is finished or cancelled.

In case of SharpSetup generated installer these responsibilities are divided between two entities:

  • main bootstrapper which comes as part of SharpSetup and can only be configured by installer developer (or completely replaced if necessary) and
  • intermediate bootstrapper which can be developed from scratch by setup package developer.

You may have noticed that Visual Studio solution generated by SharpSetup contains only IntermediateBootstrapper project. So how can the main bootstrapper be configured? During installer build process windows resources from Intermediate bootstrapper are copied to the main bootstrapper executable. This includes file version information, mainconfig.txt and translation_overrides.txt files. While version information resource is common in virtually all Windows applications the purpose of other two files may need additional explanation.

Mainconfig.txt file is a text file that contains general configuration of main bootstrapper. Each line of the file contains one directive with optional arguments separated by colon. The following directives are available:

  • addlang - add language to drop down list of available languages, multiple occurences allowed, argument is culture code (eg. en-US, fr-FR or pl-PL),
  • initiallang - language in which language selection dialog will be displayed, language argument as for addlang directive,
  • defaultlang - language which will be selected by default in language selection dialog, language argument as for addlang directive,
  • intermediateBootstrapper - name of intermediate bootstarpper executable that will be started after unpacking files and before running main user interface of the installer,
  • mainGui - name of the main graphical user interface of the installer that will be executed just after intermediate bootstrapper finished execution,
  • prereq - name of software required for starting main Gui. Currently only checking for installed .NET Framework is supported, argument may be "dotnet" + appropriate version without dot and Service Pack level (eg. prereq:dotnet35sp1).

The second file (translation_overrides.txt) and corresponding resource (IDR_TRANSLATION_OVERRIDES) should have versions for each language for which bootstrapper will be translated. Each of these files should contain translation of identifiers one at a line, with identifier separated from translation by a colon. Identifiers are for example LS_CAPTION or LS_HEADER, but it can also be a culture code. In both of these files a line prepended by a hash sign (#) is considered a comment and thus not used for translation or configuration.

It worth noting that bootstrapper that comes with first version of SharpSetup provides limited support for checking prerequisities (and no support for installing them). However, you can easily write appropriate code to support detecting and installing required software inside IntermediateBootstrapper project in C++. If checks performed inside IntermediateBootstrapper fail and you want to cancel the installation you should return non-zero value from main (_tWinMain) function.

I hope that the functions and operation of bootstrapper part of SharpSetup installer are now clear. Next articles will describe how the main Gui part of your installer can be translated and how all parts of the installer are compacted into one file.

Previous in seris: The Package project (WiX based)

Next in series: Multilanguage installers