3

I have a requirement wherein I need to execute a custom action if the installer fails (either automatically or manually failed by returning ActionResult.Failure from another custom action). I tried <Custom Action="CallMe" After="InstallFinalize"></Custom> but the CA is not called. Any help is appreciated.

Edit: Found out from logs that it is "FatalError" custom action. But then doing this <Custom Action="CallMe" Before="FatalError"></Custom> throws Error 8 Unresolved reference to symbol 'WixAction:InstallExecuteSequence/FatalError' in section 'Product:*'

Vasudev
  • 803
  • 1
  • 7
  • 16
  • What CallMe custom action does? The best practice is to implement a rollback CA for each deffered CA. So, in case of a failure the machine return to it's prev state. – Arkady Sitnitsky Jan 23 '17 at 13:59
  • All I wanted to do is log. As per my research we cannot anything from custom actions in UISequence (triggered from control events). I'm planning to write everything into a static string object, keep appending the logs into that string object. On success i'm able to dump it to the log file using session.Log. I'd like to do the same on failure of installation too. [This hack](http://stackoverflow.com/questions/3494101/wix-c-sharp-custom-action-logging-not-working#) would be my second option. – Vasudev Jan 23 '17 at 14:25
  • Have you tried: The values for OnExit are success, cancel, error, suspend – Arkady Sitnitsky Jan 23 '17 at 15:15
  • Nailed it brother. Thats exactly what i needed. Thanks a bunch. – Vasudev Jan 23 '17 at 15:52
  • Glad to here, I have added an answer. Please mark as answered. – Arkady Sitnitsky Jan 23 '17 at 16:01
  • Done. thanks again :-) – Vasudev Jan 24 '17 at 07:13

1 Answers1

1

You can use

   <Custom Action="CallMeCancel" OnExit="cancel" /> 
   <Custom Action="CallMeError" OnExit="error" />

The values for OnExit are success, cancel, error, suspend

Arkady Sitnitsky
  • 1,846
  • 11
  • 22