Defining Wix properties and values based on VS active configuration

JonDrnek picture JonDrnek · Mar 9, 2009 · Viewed 7.8k times · Source

How can I define Wix properties and values that change depending on which Visual Studio configuration is active? e.g. For our release build, var x = 1 and for the export build, var x = 2.

Answer

Rob McCready picture Rob McCready · Mar 9, 2009

We pass properties into WiX from the wixproj files using

<DefineConstants>configuration=$(Configuration)</DefineConstants>

In a PropertyGroups section. Then you can use them inside wix as $(var.configuration)

<?if $(var.configuration) = Debug ?>
  <?define x=1 ?>
<?endif ?>

The WiX help file has a whole section on preprocessor stuff, give that a look for other things you can do.