Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get the return code from a CustomAction?

I have the following CustomAction in my project:

<CustomAction Id="InstallDriver"
                  Return="check"
                  Execute="deferred"
                  Impersonate="no"
                  FileKey="FileDriverInst"
                  ExeCommand="-install" />

<InstallExecuteSequence>
    <Custom Action="InstallDriver" Before="InstallServices" />
</InstallExecuteSequence>

The program that installs the driver produces useful return codes, for example if the installation failed because the system needs to be restarted following a previous driver uninstall.

Currently if anything other than success is returned, I get a dialog saying 'A program run as part of the setup did not finish as expected.' and the installation fails. This is not optimal.

How can I get and handle return codes?

like image 382
fredley Avatar asked Apr 19 '12 13:04

fredley


People also ask

What is the value returned by a successful MSI action?

Note that custom actions that are executable files must return a value of 0 for success.


1 Answers

Windows Installer doesn't support handling custom action return values.

For an EXE custom action a non-zero return value is interpreted as an error and the installation stops. Only a win32 DLL or VBScript custom action can change the installation behavior through its return code, but it's still very limited.

If you want to reboot the machine after install, you can set the REBOOT property.

like image 149
rmrrm Avatar answered Sep 22 '22 23:09

rmrrm