Specifying Commands that Run Before, During, and After Builds

InstallShield 2016

Edition • This functionality is available in the Premier edition of InstallShield.

Project • This information applies to the following project types:

Basic MSI
InstallScript
InstallScript MSI
Merge Module
Suite/Advanced UI

Some project-specific differences are noted where applicable.

InstallShield lets you specify commands that you want to be run at various stages of the build process. For example, if you are developing a Basic MSI project, you may want to modify the .msi package that InstallShield creates at build time before InstallShield digitally signs it and streams it into the Setup.exe file. You can specify a command that runs a script that makes the required changes to the .msi package at the appropriate time during the build.

When you are entering a command, you can use any path variables and environment variables that are defined in your project, instead of using a hard-coded path. You can also use the following variables that are defined specifically for build event commands.

Build Event Variables

Variable

Project Types

Description

<ISReleaseName>

Basic MSI, InstallScript, InstallScript MSI, Merge Module, Suite/Advanced UI

This variable indicates the name of the release that InstallShield is building.

<ISProductConfigName>

Basic MSI, InstallScript, InstallScript MSI, Merge Module

This variable indicates the name of the product configuration that contains the release that InstallShield is building. (Note that this is always Media for InstallScript projects.)

<ISReleasePath>

Basic MSI, InstallScript, InstallScript MSI, Merge Module, Suite/Advanced UI

This variable indicates the build location of the release that InstallShield is building. It is set through the Release Location setting on the Build tab for a release in the Releases view.

<ISReleaseUsesShallowFolderPaths>

Basic MSI, InstallScript MSI

This variable is set to true or false to indicate whether InstallShield uses a shallow folder directory structure when building your release.

At build time, InstallShield sets temporary <ISReleaseName>, <ISProductConfigName>, <ISReleasePath>, and <ISReleaseUsesShallowFolderPaths> environment variables; InstallShield also sets temporary environment variables for all of the defined path variables in your project. You can refer to the value of one of these environment variables in a batch file by surrounding the variable name with percent signs (%); for example:

set PATH = %<ISReleaseName>%;%PATH%

When the build is complete, InstallShield deletes the temporary environment variables that it set.

To specify one or more commands that run before, during, or after a build:

1. In the View List under Media, click Releases.
2. In the Releases explorer, click the release that you would like to configure.
3. Click the Events tab.
4. In one or more of the following settings, enter the commands that you want InstallShield to run:
Prebuild Event
Precompression Event (This event is not available in Suite/Advanced UI projects.)
Postbuild Event

Enter each command as it would be launched from the command prompt. Thus, for example, if you specify a path that includes spaces, enclose the path within quotation marks.

For details about each setting, see Events Tab for a Release.

To specify more than one command for any of those settings, click the ellipsis button (...) in the setting. A dialog box opens, enabling you to enter one or more commands. Enter each command on a separate line.

If you enter more than one command for an event settings, InstallShield runs each command at build time in the order that they are listed for that setting. The build waits until a command finishes before proceeding to the next one.

Tip • A verbose build log shows each of the build events that are run at build time. To troubleshoot build events, generate a verbose log file and search for strings such as “Launching prebuild events”, “Launching precompression build events”, and “Launching postbuild events”. These areas of the log list details about the commands that are run at build time.

To generate a verbose build log, pass the -v parameter when launching IsCmdBld.exe from the command line.

See Also