Windows Installer Tutorial (1/2)

Introduction

Microsoft Windows Installer is a component of the Windows operating system. It provides a standard foundation for installing and uninstalling software. Open-source and commercial tools to create Windows Installer packages are available. One of the tools is the WiX Toolset [1] for which we provide a tutorial.

It would be unusual to create a Windows Installer package without the help of one of the higher-level tools so this tutorial focuses on what you need to know about the Windows Installer to understand what is going on under the hood. Hopefully this will help using the tools more efficiently and help troubleshoot installation packages.

Orca

Microsoft provides a tool to look at the contents of package: Orca [2]. We will make use of this tool throughout the tutorial.

Orca is available as part of the Windows SDK that you can download from http://www.microsoft.com/en-us/download/details.aspx?id=8279. However if you are only interested in Orca you can also follow the following procedure [3] to get the Orca installation package:

  1. Download GRMSDK_EN_DVD.iso from http://www.microsoft.com/en-us/download/details.aspx?id=8442.
  2. Using for instance 7-zip [4], extract the files from GRMSDK_EN_DVD.iso.
  3. In the extracted files locate the Setup\WinSDKTools\cab1.cab file and extract its contents.
  4. In the newly extracted files locate the WinSDK_Orca_Msi_5E20C107_DAA3_4D49_AFAE_7FB2594F0CDC_x86 file and add a .msi extension to it. This is the Orca installation package and you can now install it as any other package.

After installation Orca is available in the Start menu.

Basic Structure of an MSI File

A Windows Installer package is actually a file containing a relational database. The framework expects a series of predefined tables to be present in that database.

To show the tables in the database we will use the simple example we created in this WiX tutorial, SingleFileInstallation1, which simply installs a single file. You don't need to build the example, you can simply download the MSI file from here (make sure you save the file rather than execute it).

We can open the SingleFileInstallation1.msi with Orca. The result in Orca is shown on Figure 1.

SingleFileInstallation1.msi in Orca
Figure 1: SingleFileInstallation1.msi in Orca

On the left-hand side you can see the list of tables that are present in SingleFileInstallation1.msi.

Features, Components and Files

Windows Installer groups files to be installed together in features. Simple packages will contain a single feature but more complex packages can contain more and let the user choose which one they want to install. Features are further subdivided into components. These components then contain the files to be installed. The WiX tutorial shows a concrete example of this hierarchy.

Looking at SingleFileInstallation1.msi with Orca (see Figure 1 above), we can see the 4 tables that implement this organization: Feature, FeatureComponents, Component, and File. In the SingleFileInstallation1.msi case there is one feature, MainProduct, containing one component, HelloWorldComponent, which in turn contains one file, HelloWorld.

The Feature table

The Feature table [5] contains one feature: MainProduct. Figure 2 shows this table in Orca.

The Feature Table
Figure 2: The Feature Table

The FeatureComponents table

The FeatureComponents table [6] associates features with their components. In Figure 3 you can see how the MainProduct feature and the HelloWorldComponent component are associated together.

The FeatureComponents Table
Figure 3: The FeatureComponents Table

The Component table

The Component table [7] lists the various component. It doesn't list the contents of these components, the File table does that. It does however indicate in which directory the component should be installed. In Figure 4 you can see the HelloWorldComponent.

The Component Table
Figure 4: The Component Table

The File table

The File table [8] lists the files to be installed and the components they belong to. Figure 5 shows the HelloWorld file and how it is associated with the HelloWorldComponent component.

The File Table
Figure 5: The File Table

References

  1. WiX Toolset
  2. MSDN: Orca.exe
  3. How to install Orca.exe from the Windows Installer Development Tools
  4. 7-zip
  5. MSDN: Feature Table
  6. MSDN: FeatureComponents Table
  7. MSDN: Component Table
  8. MSDN: File Table

blog comments powered by Disqus

Copyright(c) 2006-2017 Xavier Leclercq | Privacy policy

Home
Contact Us
Search