09.12.2012 Views

InstallShield 2012 Spring Express Edition User Guide

InstallShield 2012 Spring Express Edition User Guide

InstallShield 2012 Spring Express Edition User Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 10: Customizing Installation Behavior<br />

Using Custom Actions<br />

Action Execution Options<br />

Custom actions are executed in the order in which they appear in a sequence. Some actions need to be<br />

scheduled to run immediately at the start of the installation; others need to be deferred for a later time.<br />

The In-Script Execution setting in the Custom Actions view enables you to select which iteration of the<br />

sequence (deferred, rollback, or commit) should trigger your action. This setting also lets you specify the<br />

context for deferred, rollback, and commit actions: actions can run in user context (with the privileges of<br />

the user running the installation) or in system context (with elevated privileges). If this setting is not<br />

displayed for a particular custom action in the Custom Actions view, that action is scheduled for<br />

immediate execution; immediate-execution custom actions always run in user context.<br />

Immediate Execution<br />

As its name implies, immediate-execution custom actions runs when the internal Windows Installer<br />

installation script is being compiled. When an .msi file is launched, the Windows Installer service<br />

converts all the tables in the installation database into an internal script. This script is built by cycling<br />

through all the actions in the installation in the order in which they appear. The building of this script is<br />

immediate execution. When an action that is set for immediate execution is encountered, that action is<br />

executed. Therefore, this action launches before any file transfers are encountered, possibly even before<br />

the end-user interface for the installation is fully loaded.<br />

As a rule, custom actions that are scheduled for immediate execution do not modify the target system,<br />

but only set properties and query the target system (for example, to see if the target system meets your<br />

product’s system requirements). Custom actions that set Windows Installer properties must be<br />

scheduled for immediate execution, and custom actions that occur in the <strong>User</strong> Interface sequence must<br />

be scheduled for immediate execution.<br />

Because actions of this type run before any changes have been made to the system, they cannot rely on<br />

files that are being installed by the installation.<br />

Deferred Execution<br />

Deferred execution takes place when the internal script that is generated during immediate execution is<br />

executed by the Windows Installer. After that script has been fully generated, the Windows Installer<br />

runs the newly compiled script. The script runs through all of the actions in your sequences and executes<br />

them in order. However, if an action is scheduled for immediate execution, the action does not run again<br />

during deferred execution.<br />

Actions that launch during deferred execution have access to files that are being installed as part of the<br />

installation. As a result, you can call a custom action that calls a function from a DLL file that is installed<br />

with your product during this phase of the installation. However, deferred execution custom actions<br />

must take place between InstallInitialize and InstallFinalize in order to work properly.<br />

Custom actions that rely on a file that is being installed to the target system, or that rely on other system<br />

changes to have already been performed, must be scheduled for deferred execution.<br />

Rollback Execution<br />

Rollback occurs when an error is encountered by the installation or the end user cancels the installation<br />

before it has a chance to complete. The rollback execution option allows you to set your action to execute<br />

only during rollback. Therefore, any actions that are enabled for rollback execution are written to the<br />

installation script, as are deferred execution actions. Unlike deferred execution actions, rollback<br />

execution actions launch only during rollback. (Rollback custom actions run only if the installation fails<br />

during deferred execution.)<br />

230 ISE-1900-UG00 <strong>InstallShield</strong> <strong>2012</strong> <strong>Spring</strong> <strong>Express</strong> <strong>Edition</strong> <strong>User</strong> <strong>Guide</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!