How can I use Custom Actions and Component Installations in my installation?
Controlling custom actions and component installations with conditions involving properties—Part 2
It can be difficult to control circumstances that cause components to install and to determine if a custom action executed. Conditions give you flexibility to resolve many types of issues in your installation.
Article 3643 ("Custom Actions and Component Installations") explains how to create conditions based on Windows Installer properties. In this article, we focus on conditions you can use in .msi installations. Read this article to learn how to obtain the "action" and "installed" state of features and components, and how to use them in conditional expressions.
You can use conditional syntax to evaluate the installed state or action state of a feature or component. The installed state returns the value that relates to the current state of the feature or component on the system. The action state reflects the future state of the feature or component, what it will be after changing from its state in the current installation.
The chart attached contains the syntax for expressions you can insert in a condition to evaluate the action or installed state of a feature or component.
See the attached document, Conditional Statement Expressions.doc, for the chart.
These states are set during the CostFinalize action. This imposes some sequence restrictions. For instance, you can use the expressions in any of the sequence tables after the CostFinalize action. Also, you can use the "?ComponentName" expression in the Condition column of the Component table. These expressions are not valid in conditional statements used in any other location in the .msi.
A common application of expressions is to conditionally execute a custom action only when a particular feature or component is being installed. For example, suppose you want to run a custom action that calls a utility to modify the database and that custom action should install when a feature, which we will call Feature 1, is installed locally or from a source. You can conditionally run the custom action to configure the database using the following expression as a condition: &Feature1>3. This expression checks to see if Feature 1 has an action state to install.
Use the conditional expressions in this article to evaluate installed and action states of components and features. Without these conditions, it is impossible to tie the execution of a custom action exclusively to a component or feature. These conditional expressions enable you to create a more dynamic installation and to create a relationship between a custom action and feature or component.
Conditional Statement Expressions.doc (30.0 KB)
Rate this Article