Custom actions in WiX allow you to execute code at various points during installation. There are several different types of custom actions, each with its own purpose and use case. In this article, we’ll go over the different types of custom actions and how to use them in your WiX projects.
Sequential Custom Actions
Exciting update! We've collaborated with Wix to offer WBI users with a free plan for all website creation needs - Explore the details here.
Sequential custom actions are the most basic type of custom action. They are executed in the order that they are defined in the WiX source file. Sequential custom actions can be used to launch executables, copy files, write to the registry, etc. Basically, anything that can be done from the command line can be done with a sequential custom action.
To define a sequential custom action, use the
The following example shows how to define a sequential custom action that launches an executable:
Conditional Custom Actions
Conditional custom actions are similar to sequential custom actions, but they are only executed if a condition is met. For example, you might want to conditionally launch an executable only if a certain file exists on the Target system. Or you might want to write to the registry only if the user is an administrator. Conditions can be anything that can be evaluated at install time.
To define a conditional custom action, use the
Immediate Custom Actions
Immediate custom actions are executed immediately after the installer initializes ( before any interfaces are displayed ). This type of custom action is typically used to perform validation or initial setup tasks that need to be done before installation begins. Immediate custom actions cannot display any user interface elements.