Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

custom action after installation failed

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)?

like image 705
Bhalchandra K Avatar asked Dec 31 '25 01:12

Bhalchandra K


1 Answers

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" />
like image 77
Yan Sklyarenko Avatar answered Jan 05 '26 13:01

Yan Sklyarenko



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!