Share via


Custom Actions

Custom actions are a Windows Installer feature that allows you to run code at the end of an installation to perform actions that cannot be handled during installation. The code can be in the form of a .dll, .exe, script, or assembly. For example, you might want to create a local database on the target computer during installation. You could create an executable file that creates and configures the database, then add that executable file as a custom action in your deployment project. For more information, see Walkthrough: Using a Custom Action to Create a Database at Installation.

The Custom Actions Editor in Visual Studio is used to manage custom actions in a deployment project. Custom actions can be added and properties for the custom actions can be set. A deployment project can contain multiple custom actions. For more information, see How to: Add and Remove Custom Actions in the Custom Actions Editor.

Custom actions are run after the actual installation is complete, so they do not have access to properties that are used to control installation. If you need to pass information from the installer to a custom action, you can do so by setting the CustomActionData property. For more information, see Walkthrough: Using a Custom Action to Display a Message at Installation.

Note

If a custom action fails, the entire installation will be rolled back.

In addition, conditions can be placed on any custom action using the Condition property. This allows you to run different custom actions based on conditions that exist on a target computer during installation. For example, you might want to run different custom actions depending on the operating system version on the target computer. For more information, see Conditional Deployment.

See Also

Tasks

Walkthrough: Creating a Custom Action

Concepts

Conditional Deployment

Reference

Condition Property

CustomActionData Property

Other Resources

Custom Actions Management in Deployment