Book Image

WiX Cookbook

By : Nicholas Matthew Ramirez
1 (1)
Book Image

WiX Cookbook

1 (1)
By: Nicholas Matthew Ramirez

Overview of this book

Table of Contents (20 chapters)
WiX Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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 you'll be running the installer, add a file called Config.js. Place it in the target machine's C: drive so that it's at C:\Config.js. Our installer will update this file, but revert it to its original version if there's an error during installation...