User Guide

500
Guidelines for Using Custom Actions
Restricted Areas
! If an action has restrictions on its placement in the sequence, the restricted areas
are shaded in the Installation Sequence list when you select the action in the
Actions list. Place the action in a non-restricted area. Restrictions are defined by
Windows Installer functionality. Example: You can’t run an action that depends on an
installed file if the file is not yet installed.
! If you use the Move Up and Move Down commands on a custom action that has
restricted placement, keep in mind that the restricted areas will not be shaded.
Before moving an action, select the action in the Actions list to view its restricted
areas.
Formatted Text
! If you use formatted text in a custom action, such as a bracketed property name, the
custom action must be placed after the CostFinalize action in the User Interface
sequence. This is a Windows Installer requirement.
! If you use formatted text in a custom action, do not put the custom action in the
Execute Deferred sequence. Formatted text strings do not convert in the Execute
Deferred sequence. The exceptions to this rule are the CustomActionData and
ProductCode properties. See Formatted and Obtaining Context Information for
Deferred Execution Custom Actions in the Windows Installer SDK Help.
Guidelines for Custom Action Conditions
Place a custom action between conditional If Statements to run it only if a certain
condition is true. A condition can check whether the product is installed, the value of a
property is true, if specific system requirements are met, and more. See Conditions on
page 406 and Conditional Statement Syntax in the Windows Installer SDK Help.
To Run Only During Initial Installation
The Execute sequences under the Normal Installation mode run during initial installation
and later during maintenance and uninstall installations. To run a custom action during
the initial installation only, set its condition to NOT Installed. Installed is a Windows
Installer property that is true if the product is installed.
Example: If you add a custom action that opens a Readme file and set the action’s
condition to NOT Installed, then the Readme opens during initial installation, but does
not open during maintenance installations (reinstall, modify, and repair operations).
Depends on a previous action in order
to run
Execute Deferred
Windows Installer does not perform the
action when it runs in Immediate mode. If
a custom action depends on a change to
the system, and the change has not yet
been made, the custom action fails.
Requires elevated privileges to run Execute Deferred
Actions run in Deferred mode can be run
under the system context. See the
description of the In-Script Options field
in Using the Custom Action Properties Tab
on page 534.
If the action does this: Place it in this sequence: