简体   繁体   English

WiX安装程序条件编译?

[英]WiX installer conditional compilation?

I have two builds of my main executable: standard and premium .我的主要可执行文件有两个版本: standardpremium For simplicity of development they are built from a single solution in Visual Studio by changing a special #define variable.为简化开发,它们是通过更改特殊的#define变量从 Visual Studio 中的单个解决方案构建的。

Now I'm curious if it's possible to do the same with the WiX installer for this project?现在我很好奇是否可以对这个项目的 WiX 安装程序做同样的事情?

I basically need to control the inclusion of only one of the following xml nodes:我基本上需要控制只包含以下 xml 节点之一:

1: For standard version MSI: 1:对于standard版 MSI:

<Product Name='Foobar 1.0 - Standard' 
    Id='8E9CF27F-B92F-4CB3-BBA0-0AAE5376D5EB' 
    UpgradeCode='20A89269-D206-490D-9134-349594662619'
    Language='1033' 
    Codepage='1252' 
    Version='1.0.0' 
    Manufacturer='Acme Ltd.'>

and later:然后:

<Component Id='MainExecutable' Guid='E1FE2BBE-C72D-4F27-A66D-78417F597D7A'>
 <File Id='FoobarEXE' Name='FoobarAppStandardl10.exe' DiskId='1' Source='FoobarApplStandard10.exe' KeyPath='yes'>

2: For premium version MSI: 2:对于premium版 MSI:

<Product Name='Foobar 1.0 - Premium' 
    Id='8E9CF27F-B92F-4CB3-BBA0-0AAE5376D5EC' 
    UpgradeCode='20A89269-D206-490D-9134-34959466261A'
    Language='1033' 
    Codepage='1252' 
    Version='1.0.0' 
    Manufacturer='Acme Ltd.'>

and then:进而:

<Component Id='MainExecutable' Guid='E1FE2BBE-C72D-4F27-A66D-78417F597D7B'>
 <File Id='FoobarEXE' Name='FoobarAppPremiuml10.exe' DiskId='1' Source='FoobarApplPremium10.exe' KeyPath='yes'>

PS.附注。 I can obviously make 2 WiX projects... I'm seeking a way to do it in one.我显然可以制作 2 个 WiX 项目......我正在寻找一种方法来做到这一点。

I found it.我找到了。 Here it is for whoever else is interested. 这里是给其他感兴趣的人的。

In my case, i need to pass the symbol compilation to the project that will compile.就我而言,我需要将符号编译传递给将要编译的项目。 I solved recompiling and passing the symbols.我解决了重新编译和传递符号的问题。

For this, edit the wix project eg "xx.wixproj", and at the end of the file insert:为此,编辑 wix 项目,例如“xx.wixproj”,并在文件末尾插入:

<Target Name="MyName" AfterTargets="AfterResolveReferences">
 <MSBuild Projects="Path\xx.csproj" Properties="Configuration=$(Configuration);Platform=$(Platform);DefineConstants=$(DefineConstants)%3bMYSYMBOL;OutputPath=$(OutputPath)" />
</Target>

Unfortunately, this solution in vs 2017 (with .netstandard dlls) and WiX 4, not run.不幸的是,此解决方案在 vs 2017(使用 .netstandard dll)和 WiX 4 中无法运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM