Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Defining Wix properties and values based on VS active configuration

Tags:

wix

wix3

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.

like image 763
JonDrnek Avatar asked Mar 09 '09 16:03

JonDrnek


People also ask

Where are WiX variables defined?

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.

How do you use variables in WiX?

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.

How do I use heat EXE on WiX?

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.


2 Answers

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.

like image 190
Rob McCready Avatar answered Oct 19 '22 17:10

Rob McCready


I am using WiX 3.10 and $(var.Configuration) just worked for me.

like image 26
Colin Avatar answered Oct 19 '22 16:10

Colin