[英]How can the Wix Installer distinguish target builds?
My C# project in Visual Studio will be installed via Wix. 我在Visual Studio中的C#项目将通过Wix安装。 I have two target builds: Demo and Release.
我有两个目标版本:Demo和Release。 I want to distinguish these builds and add the suffix 'Demo' to the name of the product:
我想区分这些版本,并在产品名称后添加后缀“ Demo”:
#if Demo
<?define Suffix = "(Demo)"?>
#endif
<Product [...] Name="MyApp $(var.Suffix)" [...] >
How can I make work this? 我该如何工作?
With the following code you can define producttarget
WiX variable based on Configuration
MSBuild property: 使用以下代码,您可以基于
Configuration
MSBuild属性定义producttarget
WiX变量:
<!-- Somewhere in .wixproj -->
<PropertyGroup>
<DefineConstants Condition=" '$(Configuration)' == 'Debug' ">$(DefineConstants);producttarget= (Demo)</DefineConstants>
<DefineConstants Condition=" '$(Configuration)' == 'Release' ">$(DefineConstants);producttarget=</DefineConstants>
</PropertyGroup>
And then use producttarget
in your Product
declaration: 然后在
Product
声明中使用producttarget
:
<Product Id="*"
Name="SetupProject1$(var.producttarget)"
Language="1033"
Version="1.0.0.0"
Manufacturer="Manufacturer1"
UpgradeCode="41169d90-ca08-49bc-b87b-4b74f1f50d0e">
I got a solution by my self. 我自己解决了。 I can distinguish between the demo and the release using
var.ProjectName.Configuration
and Wix´s preprocessor. 我可以使用
var.ProjectName.Configuration
和Wix的预处理器来区分演示和发行版。
This is my switch: 这是我的开关:
<?if $(var.ProjectName.Configuration) = Demo ?>
<?define Suffix = "(Demo)" ?>
<?else ?>
<?define Suffix = "" ?>
<?endif ?>
Adding the suffix (Demo) to my Product: 将后缀(Demo)添加到我的产品中:
<Product [...] Name="MyApp $(var.Suffix)" [...] >
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.