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

Including one component or another depending on the condition


An installer should be able to adapt to its surroundings, to mold itself to the operating system or other constraints it detects. WiX has this sort of intelligence baked in. By using conditions, we can prevent a component from being installed if it's not a good fit and simultaneously allow a different component to be installed.

In this recipe, we'll store two XML files in the MSI and select only one of them to install based on the target operating system. We'll be using a built-in property called VersionNT to get the operating system, but this can be extended by defining our own custom properties. For example, you might install a component if the user selects Yes for a radio button in the user interface. Or, you might install debug versions of your DLLs depending on whether you're installing to a development machine.

Getting ready

To prepare for this recipe, perform the following steps:

  1. Create a setup project and name it ConditionalComponentsInstaller...