Testing rollback custom actions with WixFailWhenDeferred

For every custom action that changes the end user's system, you should also author a rollback custom action that reverts those changes in the event of an error. The big question then is how do we test that the rollback works? In this recipe, we'll briefly outline a scenario where a rollback will be needed and then discuss how to trigger one for testing purposes.

In our example, there will be a file that already exists on the computer. Our installer updates a value within it. However, if the installation fails for some reason and a rollback is triggered, the file should be reverted to its original state.

Getting ready

To prepare for this recipe, perform the following steps:

  1. On the computer where ...

Get WiX Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.