CustomActionData Property

Specifies additional data that can be evaluated by a custom action during installation. Custom actions are run at the end of an installation and cannot access information about the installation; the CustomActionData property for each custom action allows you to store information about the installation that can be read by that custom action.

For example, if your deployment project included a file search with a Property property of FILESEARCH1, you could pass the value returned by the file search by setting the CustomActionData property to /MyFile=[FILESEARCH1]. In your custom action, you could query the MyFile property to retrieve the value.

Remarks

The format for the CustomActionData property depends on the type of the custom action.

  • For custom actions that are installation components (ProjectInstaller classes), the CustomActionData property takes a format of /name=value. Each name must be unique and have only one value. Multiple values must be separated by a single space: /name1=value1 /name2=value2. If the value has a space in it, it must be surrounded by quotation marks: /name="a value".

    Windows Installer properties can be passed using the bracketed syntax: /name=[PROPERTYNAME]. For Windows Installer properties such as [TARGETDIR] that return a directory, in addition to the brackets you must include quotation marks and a trailing backslash: /name="[TARGETDIR]\".

    Note

    In order for a custom action to be treated as an installation component, the InstallerClass property must be set to true. For more information, see RunInstallerAttribute.

  • For all other custom actions (.exe, .dll, or script), there are no format requirements. You can pass any string in the CustomActionData property, since you must parse it yourself in your custom action.

Troubleshooting

If your custom action relies on customers typing a path to an installation folder, you may see a ArgumentException error message. This may be related to an invalid directory or URL.

To prevent this error message, replace the backslash with a space: /name="[TARGETDIR] ". Then, parse the value and create a fully qualified path using the Combine method.

See Also

Tasks

Walkthrough: Using a Custom Action to Display a Message at Installation

Reference

Properties for the Custom Actions Editor

InstallerClass Property