by Robert Dickau, Principal Technical Training Writer, Flexera Software
Instead of using an explicit script, Windows Installer (MSI) uses sequences to specify the order in which operations are performed and the conditions under which they are performed. This white paper introduces Windows Installer sequences, and describes some of the built-in actions that make up a typical installation program.
It also highlights how InstallShield® from Flexera Software makes it easier to work with sequences and standard actions
Learn More about InstallShield
If you wish to learn more about the capabilities of InstallShield, please visit the Flexera Software Web site at www.flexerasoftware.com/installshield.
Using the InstallShield Environment
This white paper frequently refers to the InstallShield development environment. It is assumed you are familiar with the general layout of the InstallShield interface, which contains a list of views with which you can modify different portions of your installation project.
For example, the General Information view is where you set general product and project properties; the Setup Design view enables you to edit the features, components, and component data used by your project; the Registry view enables you to modify the registry data installed by your installation program; and the Direct Editor view gives you access to the raw MSI database tables.
The InstallShield Help Library contains information about using every view and wizard in the InstallShield environment. The InstallShield Help Library is available when you press F1 with any view selected; you can also select Contents from the Help menu to view the help library.
In addition to the graphical environment, InstallShield provides several tools for modifying and building projects from the command line or an external script. For example, to build a project from the command line, batch file, or other automated process, you can use the executable IsCmdBld. exe. The IsCmdBld executable is located in the System subdirectory of the InstallShield distribution directory.
To rebuild a project, you pass IsCmdBld the project file path, the product configuration name, and the release name that you want to rebuild. A sample command appears as follows:
iscmdbld -p C:\ProductName.ism -a BuildConfig -r ReleaseName
In addition, InstallShield provides an Automation interface, with which you can modify the contents of a project file without using the graphical environment.
Windows Installer supports three types of installation, called a normal installation, administrative installation, and advertised installation.
- A normal installation is the type performed when the user double-clicks an MSI database file, or runs msiexec.exe with the /i switch (or the /package switch, starting with Windows Installer 3.0). This white paper focuses on normal installations.
- An administrative installation simply creates an uncompressed version of the installation image in a specified target directory, usually a network location. An administrator performs an administrative installation by launching msiexec.exe with the /a switch. An administrative installation does not register the product with the target system, in the sense that an administrative installation creates no shortcuts, no registry data, no uninstallation entry, and so forth.
- An advertised installation installs various application “entry points”—shortcuts, file-extension information, and COM information—but does not install any application data (files, registry data, and the like) until the user invokes one of these entry points. Advertised installations are useful for saving disk space on the target system until the product or specific features of it are needed. A user can advertise an installation by passing msiexec.exe the /jm or /ju switch, indicating per-machine and per-user advertisement, respectively.
Each of these installation types is represented by a top-level sequence. You can inspect and manipulate these top-level sequences in the Custom Actions and Sequences view of the InstallShield environment, in the “Behavior and Logic” view group.
User Interface and Execute Subsequences
Each of the top-level sequences is divided into two subsequences, called the User Interface (UI) sequence and the Execute sequence. For a normal installation, these sequences are represented by the MSI database tables InstallUISequence and InstallExecuteSequence. (The tables used for the advertisement and administration sequences are called AdvtUISequence, AdvtExecuteSequence, AdminUISequence, and AdminExecuteSequence.) In the InstallShield environment, each of the subsequences is displayed in a separate tree under the corresponding toplevel sequence.
In general, the User Interface sequence shows dialog boxes and queries the user and the target system, but does not perform any system changes. On the other hand, the Execute sequence performs system changes, but does not display any user-interface elements.
A normal installation runs both the User Interface sequence and the Execute sequence. A silent installation performs only the Execute sequence, meaning that any actions in the User Interface will be skipped for a silent installation. Reduced-UI and basic-UI installations, such as an uninstallation launched from the Remove button in the Add or Remove Programs panel, also skip the actions in the User Interface sequence. Similarly, launching an installer in test mode from the InstallShield environment (by clicking the Test toolbar button or pressing Ctrl+T) effectively runs only the User Interface sequence.
The User Interface sequence and the Execute sequence run in different processes. The two processes communicate using properties. Only the values of public properties—those with an all-uppercase name, such as MYCUSTOMPROPERTY— are passed from the User Interface sequence to the Execute sequence. (Such properties should also be listed in the SecureCustomProperties property.) Values of private properties—those with a name that contains a lowercase letter, such as Privileged—will be reset to their defaults when execution switches from the User Interface sequence to the Execute sequence.
Introduction to Actions
Sequences are ordered lists of actions, where an action corresponds to one operation performed by the installation. If you expand a sequence icon in the Sequences tree, you can view the individual actions contained in that sequence. The following figure shows some of the actions appearing in the User Interface sequence of a typical installation project.