User Guide
499
Guidelines for Using Custom Actions
Guidelines for Using Custom Actions
When you use Windows Installer to install a file, it takes care of the repair and
management of the file. When you use a custom action to change an installation, you
take Windows Installer out of the loop. (Example: If you use a custom action to install a
file, you must also include custom actions to repair or uninstall the file because Windows
Installer is unaware of the file.) Therefore, use custom actions conservatively when
making permanent changes on the destination computer, and use them only for actions
that cannot be accomplished through Windows Installer. See Uninstalling Changes Made
by a WiseScript on page 496.
Caution
Although you can change the order and conditions for standard actions and dialogs, we
recommend that you do not change these settings unless you are proficient in the Windows
Installer development environment. Many actions have restrictions that determine where they
must appear in the sequence. See Actions with Sequencing Restrictions in the Windows
Installer SDK Help for more details.
The following topics provide guidelines for using custom actions:
Guidelines for Custom Action Location
Guidelines for Custom Action Conditions on page 500
Guidelines for Nested Installation Custom Actions on page 501
Guidelines for Calling VBScripts and JScripts on page 502
Guidelines for Calling .DLLs on page 502
Guidelines for Custom Action Location
General
! Place the custom action as high in the sequence as possible where it executes
properly. If it doesn’t execute properly when you test it, keep moving it lower in the
sequence until it works.
! If the custom action uses information that’s gathered during the User Interface
sequence, place it after the actions that gather the information you need.
! If the installation is run silently, items in the User Interface sequence do not execute.
Correct Sequence
If the action does this: Place it in this sequence:
Gathers input from an end user User Interface
Needs to change properties User Interface or Execute Immediate
Is an Install MSI custom action Execute Immediate
Is to be executed sometime during the
installation of files
Execute Immediate or Execute Deferred
Place it between the InstallInitialize and
InstallFinalize actions, near the InstallFiles
action. The InstallFiles action installs files
during deferred mode.
Makes a change to the system Execute Deferred