简体   繁体   English

适用于多个项目的通用Wix安装程序

[英]Generic Wix Installer for multiple projects

I am new to Wix so forgive me for any terms I may use incorrectly. 我是Wix的新手,所以请原谅我可能错误使用的任何术语。

I have a large solution with many projects some of which become installable services, executables and what not. 我有一个包含许多项目的大型解决方案,其中一些项目成为可安装的服务,可执行文件,而其他项目则不能。 In the post build events of projects that will have an installer I run the following to generate a fragment containing all the files the installer will need. 在将具有安装程序的项目的构建后事件中,我运行以下命令来生成一个片段,其中包含安装程序所需的所有文件。

"C:\\Program Files (x86)\\WiX Toolset v3.8\\bin\\heat.exe" dir $(TargetDir) -ag -cg harvestedComponents -out $(TargetDir)$(ProjectName).wxs

I want to create one single Wix setup project that has a component reference placeholder that I can then link to the fragment. 我想创建一个具有组件引用占位符的Wix安装项目,然后可以将其链接到该片段。 This way I can reuse the functionality of the one setup project and not need a setup project for each installable item I have. 这样,我可以重复使用一个安装项目的功能,而无需为我拥有的每个可安装项目都安装一个项目。 From there I would have a second build event that would link/compile the fragment and project along with passing in flags to the generic installer project that could turn on/off install features, such as adding event source, different custom actions and such. 从那里,我将产生第二个构建事件,该事件将链接/编译片段和项目,同时将标志传递给可以打开/关闭安装功能的通用安装程序项目,例如添加事件源,不同的自定义操作等。

So my question is how do I link/compile a fragment with a generic Wix project from a post build event of the executable project. 因此,我的问题是如何从可执行项目的构建后事件中将片段与通用Wix项目链接/编译。 I am guessing it would look something like: 我猜它看起来像:

Candle/Light.exe fragment.wxs generic.wxs -eventLog true -customAction1 true -msiName MyInstaller.msi

Where I would use the values of eventLog customAction1 inside the generic file to enable/disable install features. 我将在通用文件中使用eventLog customAction1的值启用/禁用安装功能的位置。

Sorry for the confusion and hope this is possible. 很抱歉造成混乱,希望这是可能的。

If I understood it correctly you want to reference the fragment created by heat ( $(TargetDir)$(ProjectName).wxs ) in your generic WiX source file? 如果我正确理解,您是否要引用通用WiX源文件中由热( $(TargetDir)$(ProjectName).wxs )创建的片段?
If this is the case you just have to add a ComponentGroupRef -tag below your Feature -element (instead of a ComponentRef -element you would use normally). 如果是这种情况,您只需在Feature -element下面添加ComponentGroupRef -tag(而不是通常使用的ComponentRef -element)。 As Id for the elemenet you have to use the name of the ComponentGroup that you used in the heat-commandline, harvestedComponents in your example. 至于Id为elemenet你必须使用的名称ComponentGroup您在热命令行中使用, harvestedComponents在你的榜样。 Eg 例如

<Feature Id="MyFeature" ...>
    ...
    <ComponentRef Id="aNormalComponentFromTheCurrentFile" ... />
    ...
    <ComponentGroupRef Id="harvestedComponents" />
</Feature>

Or did I miss the point? 还是我错过了重点?

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

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