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.
WiX has some built-in variables. They are referenced with the syntax $(sys. VARNAME) and are always in upper case. The current directory where the build process is running.
To add a project reference to a WiX project: Right-click on the References node of the project in the Solution Explorer and choose Add Reference.... In the Add Reference dialog, click on the Projects tab. Select the desired project(s) and click the Add button, and then press OK to dismiss the dialog.
Navigate to WiX's bin directory from a command prompt and type heat.exe -? to see information about its usage. To make things easy, consider adding the path to the WiX bin directory to your computer's PATH environment variable so that you won't have to reference the full path to the executable each time you use it.
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.
I am using WiX 3.10 and $(var.Configuration)
just worked for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With