0

I'm creating MSI using Wix Toolset v3.11

I'm using two Custom Actions, a Deferred custom action and it's corresponding Rollback custom action. I'm calling a console application exe file for both the custom actions. If I'm closing the console app cmd window, the rollback custom action gets triggered and it's working fine.

But when I cancel the MSI installation itself, through clicking on Cancel Button of Progress Dialog, the rollback custom action don't trigger.

Here's the sample code:

<CustomAction Id="DoSomething" Execute="deferred" FileKey="abc.exe" ExeCommand="xyz" />
<CustomAction Id="DoSomething_Rollback" Execute="rollback" FileKey="abc.exe" ExeCommand="xyz_rollback" />

<InstallExecuteSequence>
      <Custom Action="DoSomething_Rollback" Before="InstallFinalize">TrueCondition</Custom>
      <Custom Action="DoSomething" After="DoSomething_Rollback">TrueCondition</Custom>
</InstallExecuteSequence>

I've tried the solution mentioned here - WIX - Run custom action on installation cancellation

When I set the OnExit="Cancel", it starts giving error (DoSomething_Rollback is a custom action whose source is an installed file. It must be sequenced after the CostFinalize action) and project doesn't build.

Hemendra
  • 378
  • 5
  • 13

1 Answers1

0

You are probably scheduling the CAs wrong. It's hard to be sure without looking at the InstallExecuteSequence table in the built MSI. You are saying Rollback is before InstallFinalize and Deferred is after Rollback. That might get confusing.

Instead say Deferred is before InstallFinalize and Rollback is before Deferred.

Christopher Painter
  • 54,556
  • 6
  • 63
  • 100
  • Tried putting Deferred before InstallFinalize and Rollback before Deferred, still same issue. Also I checked the InstallExecuteSequence table of MSI with ORCA tool, in both cases Rollback CA is coming before Deferred CA(seq no. is +1 than Rollback CA). – Hemendra Jun 04 '20 at 12:10
  • Can you share your MSI with me? It's hard to know what's going on without more information. – Christopher Painter Jun 04 '20 at 12:20
  • When I made the deferred CA to run After="WriteRegistryValues" instead of Before InstallFinalize, it's working fine. When I cancel the installation, rollback CA triggers perfectly. No idea why it's working this way. I'll try to create a dummy MSI on weekend and share it with you. – Hemendra Jun 10 '20 at 11:06