Now that we know how does SharpSetup relate to popular tools on the market and what principles it attempts to follow let us have a closer look at how SharpSetup based installer is built and how it operates.
SharpSetup based installer has 3 main parts:
- MSI package,
- External UI,
Let us have a closer look at each of them in turn.
MSI package is the core of every Windows Installer based setup package. In case of SharpSetup this MSI package will contain only non-UI elements like files to copy, registry entries to create, permissions to set, custom actions to execute. It will also contain logical grouping of those elements into components and features. The package will be created in a toolset named Windows Installer XML (WiX) which is the most feature complete set of tools for MSI database authoring. It provides code-completion for WiX XML files and Visual Studio project support. On this level SharpSetup adds features like automatic component generation (choose file or directory and SharpSetup will create an XML fragment with component or component group).
External UI is the main user interface of SharpSetup based installer. Typically it will be a .NET application written in C# using WinForms. But it will be perfectly possible to change it to Windows Presentaion Foundation based UI written in Visual Basic given some amount of additional work. However, let's focus on the basic scenario (C#/WinForms). SharpSetup will provide setup developer with 4 main benefits in that area:
- basic classes to interact with Windows Installer (wrappers around native functions) like MsiConnection and MsiDatabase. These classes take care of operation such as detecting if package is already installed, performing costing, executing the actual install/uninstall/reinstll processes, applying transforms, etc.
- user controls to view and modify current state of installation. These components control such things as installtion location, installation mode, feature selection, installation progress and disk usage.
- template dialogs to quickly create common steps like welcome dialog, license agreement dialog, prerequisite check dialog, installation progress dialog, finish dialog, etc.
- main application framework so that setup developer does not have to worry about when each dialog will be displayed. The only thing that needs to be done is to instantiate a dialog for given installation mode and set it's type.
Bootstrapper is then thing that wraps all the other parts and provides user of your installer with a place to start. It has several functions:
- ask user for the preferred language of the installation,
- unpack files to temporary directory (showing progress),
- check for basic system requirements (eg. system version and service pack level), and software needed to run External UI (eg. .NET framework),
- run External UI to perform installation,
- clean up temporary files when they are no longer needed.
Bootstrapper provided with SharpSetup is written in such a way that is allows arbitrary C++ code to be injected so that setup developer is able to perform custom checks on the system before External UI is executed.
This description provides only high level logical view of SharpSetup based installer. When creating actual setup package one has to take care of issues such as building translations and assembling all components into one file. Fortunately SharpSetup automates all of these tasks so that building an installer is as simple as issuing Build command in Visual Studio.
Next articles will describe deatils of installer build and startup process.
Previous in series: What is SharpSetup
Next in series: First SharpSetup screenshots