Conditionally Launching Custom Actions Based on Release Flags

InstallShield 2014

Project: This information applies to the following project types:

Basic MSI
InstallScript MSI

When your installation is built, InstallShield automatically adds a property called ISReleaseFlags to the Property table. This property contains all of the release flags that are included in the build. These flags appear exactly as they do in the Release Flags setting in the Releases view. Multiple flags are separated by a comma.

A custom action can be conditionally launched based on release flags in the following ways.

Configuring the Condition Setting

The easiest way to conditionally launch a custom action is to set the Condition setting when you insert the custom action into a sequence. In this case, you can enter a condition such as ISReleaseFlags><"MyReleaseFlag" in the Condition setting. This condition succeeds if the substring “MyReleaseFlag” is contained in the value of the ISReleaseFlags property.

Calling MsiGetProperty

A more robust way to set a condition on your custom action based on release flags is to author a call to MsiGetProperty within the custom action. In addition to determining if the action should launch, you can also indicate what code is executed by the action. For example, you can use one function from a DLL file for all scenarios, yet provide different functionality for each scenario through conditional logic within your function.

The drawback to conditionally launching your custom action in this way is that you can use only a script or DLL custom action. Additionally, your custom action still launches behind the scenes. When the custom action launches, it can check if a specified release flag has been included in the build. If that flag exists, the custom action continues. If the flag is not there, the action exits.

See Also