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 allows you to store information about the installation that can be read by the 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.
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 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.
CustomActionData = /SOURCEDIR="[SOURCEDIR]\"
Error 1001. Error 1001. Exception occurred while initializing the installation:
System.IO.FileNotFoundException: Could not load file or assembly 'file:///C:\Windows\SysWOW64\Files' or one of its dependencies. The system cannot find the file specified..
http://harriyott.com/2006/11/filenotfoundexception-with.aspx
I didn't need the SOURCEDIR parameter for my uninstall action; I saved it in the IDictionary from the Install instead so I just removed the CustomActionData from Uninstall. Perhaps someone can find out the correct syntax!
- 9/20/2010
- Alan Singfield
- Always best to include values in "" (quotes) - This way if you have SPACE in your args, they are handled [Otherwise you might get errors]
- Add ONLY one "trailing backslash" if you are using TARGETDIR as shown below
Good working example:
/Param1="[PARAM1PROP]" /Param2="[PARAM2PROP]" /TARGETDIR="[TARGETDIR]\"
