Defining Wix properties and values based on VS active configuration

孤者浪人 提交于 2019-12-03 16:42:40

问题


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.


回答1:


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.




回答2:


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




回答3:


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



来源:https://stackoverflow.com/questions/627027/defining-wix-properties-and-values-based-on-vs-active-configuration

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!