How to sequence a custom action to execute only when installation is interrupted or completed with error?
Is there any windows installer property which returns current installation status (failed/succeed)?
The OnExit attribute of the <Custom> element is what you're looking for. It is mutually exclusive with Before, After, and Sequence attributes and can have the following values: success, cancel, error, suspend.
UPDATE: basically, this is what I mean:
1) Define a custom action which will do the work you'd like it to do (gather some failure data). Note that you'll have to define N custom actions pointing to the same target because the CustomAction MSI table expects Id as a primary key (let's assume it's DLL CA):
<CustomAction Id="LogFailureOnCancel" BinaryKey="CustomActions" DllEntry="LogFailure" ... />
<CustomAction Id="LogFailureOnError" BinaryKey="CustomActions" DllEntry="LogFailure" ... />
NOTE: both definitions point to the same real action (DllEntry attribute).
2) Schedule these custom actions appropriately:
<Custom Action="LogFailureOnCancel" OnExit="cancel" />
<Custom Action="LogFailureOnError" OnExit="error" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With