Setting Feature Conditions

InstallShield 2019

Project • This information applies to the following project types:

Basic MSI
InstallScript MSI
MSI Database
Transform

Conditional installation of your features can be useful if you are creating different versions of the same product—for example, a trial version and a full version. You might not want to provide full functionality in the trial version; therefore, you would not install all of the features. Another use for conditional feature installation is to save disk space. If the target system does not have enough disk space for all of the features, you can set non-required features to install conditionally.

To set a condition for a feature in your project:

1. In the View List under Organization, click Setup Design or Features.
2. Select the feature that you want to configure.
3. Click the Condition setting and then click the ellipsis button (...). The Feature Condition Builder dialog box opens.
4. Click the New Condition button. InstallShield adds a new condition row to the Conditions box.
5. In the Level column, type the install level that should be used for the feature if the condition is met.

Note that if the condition is met, this value overrides the value that is specified for the feature’s the Install Level setting.

6. Do one of the following:
In the Condition column, type the feature condition.
Use the Properties list, the Operators list, and the Add buttons to build your condition:
a. In the Properties list, select a property and then click the Add button. InstallShield adds the property to the Condition column.
b. If your conditional statement should contain an operator, select an operator in the Operators list and then click the Add button. InstallShield adds the operator to the conditional statement.
c. If your conditional statement should contain a value, double-click the condition field, press END so that the insertion point is at the end of the condition statement, and enter the value.
7. Click OK.

Important • InstallShield performs basic condition validation; however, you should still double-check that your condition statements evaluate to the expected outcome. For more information and example conditions, see Building Conditional Statements.

Run-Time Behavior for Feature Conditions

The default install level of a feature is the value that is configured in the Install Level setting in the Features view or the Setup Design view. This value is overridden if a feature condition evaluates as true; in this case, the install level of the feature is set to the Level value that is associated with the true conditional statement.

Each feature’s install level value is compared to the value of the global public property INSTALLLEVEL; only those features with install level values less than or equal to INSTALLLEVEL are selected for installation.

For example, if you have a feature that you want to be selected by default only if the end user has elevated privileges, you can give the feature a condition of Not Privileged and set the install level for that condition to 200. If the end user does not have elevated privileges, the condition is true, and the feature will be given the install level 200. Because 200 is greater than the default product install level (100), the feature will not be selected by default.

Tip • You can conditionally hide a feature by giving the feature a condition that sets the install level to the number 0. If the condition is true, the feature will be deselected, and it will not be displayed in the CustomSetup dialog.

See Also