Defining Wix properties and values based on VS active configuration
Asked Answered
S

3

14

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.

Shiri answered 9/3, 2009 at 16:40 Comment(0)
T
13

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.

Tiptop answered 9/3, 2009 at 17:43 Comment(0)
S
6

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

Soper answered 28/9, 2016 at 16:18 Comment(1)
Helpful link from @user797717 post below: blogs.msdn.com/b/jrock/archive/2008/01/29/…Gareth
B
1

You can use Project Reference Variables for that. No need to specify constants.

Sample steps:

  1. Add a project reference (of the application) to your setup project

Right Click 'References', 'Add References'

  1. Use project reference values in your wxs file

$(var.ProjectName.Configuration)

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

Resources:

Complete list of Candle preprocessor variables

Using Project references and variables

Bedizen answered 19/7, 2015 at 15:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.