如何在Wix安装项目中引用GAC的dll文件?
我们有几个第三方控件,它们在开发机器上经过 GAC 处理。这些在 Visual Studio 项目中引用。当我们使用 VS 安装项目时,它知道如何查找引用的文件并将它们包含在 MSI 中。但是,我不知道如何将 GAc 中引用的 DLL 文件包含在我们新的 WIX 设置中。我该把什么作为来源?
<文件 ID="MyFile" Name="MyFile" Source="这里要放什么?" DiskId="1" Vital="yes" KeyPath="no"/>
还有一个额外的问题:如何通过加热或其他方式自动收获这些?
We have several 3rd party controls which are GAC'd on the development machines. These are referenced in the Visual Studio projects. When we were using VS setup projects, it knew how to find the referenced files and include them in the MSI. However, I can't figure out how to include the referenced DLL files from the GAc in our new WIX setup. What do I put as the Source?
<File Id="MyFile" Name="MyFile" Source="WHAT TO PUT HERE?" DiskId="1" Vital="yes" KeyPath="no"/>
Also a bonus question: how to harvest these automatically with heat or by other means?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
对这两个问题的简短回答:你不能也不应该。您应该将工具签入源代码管理系统,并通过结帐将其加载到安装程序中。这样您就可以控制要分发的版本,而不是从 GAC 获取任意版本。
注意:DiskId 和 Vital 都默认为您提供的值,因此您可以通过省略它们来节省一些输入。
Short answer to both: You can't and you shouldn't anyway. You should check your tools into your source-control system and load it into your installers from a checkout. That way you have control over the versions you're distributing instead of picking up arbitrary versions from the GAC.
Note: DiskId and Vital both default to the values you give, so you can save some typing by just omitting them.
不幸的是,Heat 中有一个已知错误,它无法复制收获项目时引用的程序集。
撇开这个问题不谈,考虑到 @Bob Arnson 对这个问题的回答,您可以在引用的程序集上设置 CopyLocal 属性,以便在构建时将它们从 GAC 复制到项目输出目录中。然后,您可以使用 Heat 的目录收集(而不是有缺陷的项目收集)将它们包含在构建中。
Unfortunately, there is a known bug in Heat which prevents it from copying referenced assemblies when harvesting a project.
That issue aside, and taking into account @Bob Arnson's answer on this question, you could set the CopyLocal attribute on the referenced assemblies so that they are copied from the GAC into the project output directory at build time. Then you can use Heat's directory harvesting (as opposed to the buggy project harvesting) to include them in the build.