![]() | Frequently Asked Questions about Custom Actions. |
| Home | Contact | Site Map | |
| USER GUIDE | Frequently Asked Questions about Custom Actions
Why doesn't my custom action run during a patch?Any custom action in a MSI package uses a condtion which determines if it will run. This condition can be null (always execute), Not Installed (only during the first installation), Remove = "ALL" (only during uninstall) etc. In order to execute a custom action during a patch you can add the condition PATCH. This is a property which is set only when a patch runs. Why does my custom action fail even though the return code is ignored?When Windows Installer tries to launch a custom action, there are two possible scenarios for failure:
If you use an option which ignores the return code of the custom action, it will work only if the custom action is launched successfully (it returns something). If the custom action cannot be launched, the installation will fail even if the return code is ignored. How do I show a standard action?You can see a standard action by using the "Show Standard Action" button on the toolbar of the Custom Actions page. Why doesn't my BAT custom action work?BAT files cannot be lauched as Installed or Attached custom actions. However, they can be launched through "Launch file or open URL" custom actions. Note that the "Command Line" field of the custom action must contain the full path of the BAT file. How do I launch an application with a specific working directory?This can be done by using an "Exe with working Dir" custom action. The working directory can be set to any folder in the "Files and Folders" page. Why does my custom action return empty strings for the properties it uses?Windows Installer allows only "Immediate" custom actions to access installer properties during the installation. Therefore, a "Deferred", "Rollback" or "Commit" custom action will not have access to installer properties (the properties will be empty when the custom action runs). If you want to use properties in a "Deferred" custom action you can use the Action Data field. How do I remove a trailing backslash from the value of a property?A trailing backslash can be removed through a simple VBScript custom action. For the APPDIR property the VBScript code can look like this: path = Session.Property("APPDIR")
If Right(path, 1) = "\" Then
pathNew = Left(path, Len(path) - 1)
Else
pathNew = path
End If
Session.Property("APPDIR_NEW") = pathNew First, the value of the APPDIR property is placed into a variable ("path"). If this value ends in a backslash, the last character is removed, otherwise, the value remains the same. In both cases the resulted value is placed in another variable ("pathNew"). After that, the new variable sets the value of another installer property. This property will contain the original value, but without the trailing backslash. How can I automatically set the installation path based on the target OS?This can be done by setting the "APPDIR" property with multiple Property set with Formattedcustom actions (one for each custom path). The custom actions can be scheduled under "InstallUISequence" -> "Begin" and they can be conditioned with the VersionNT property. In order to execute the custom actions when there is no UI, you can drag and drop them over "InstallExecuteSequence" -> "Begin" while the SHIFT key is pressed. Also, the "Execute only once if present in both sequence tables option" should be selected. |
