如何在两个 WiX 项目中共享 WiX 片段? [英] How do I share a WiX fragment in two WiX projects?

查看:35
本文介绍了如何在两个 WiX 项目中共享 WiX 片段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在文件 SomeDialog.wxs 中有一个 WiX 片段,提示用户输入一些信息.它在控制对话顺序的 InstallerUI.wxs 文件中的另一个片段中被引用.当然,Product.wxs 是我们的主文件.效果很好.

We have a WiX fragment in a file SomeDialog.wxs that prompts the user for some information. It's referenced in another fragment in InstallerUI.wxs file that controls the dialog order. Of course, Product.wxs is our main file. Works great.

现在我有另一个应用程序的 .MSI 的第二个 Visual Studio 2008 Wix 3.0 项目,它需要向用户询问相同的信息.我似乎无法找出共享文件的最佳方式,以便更改请求的信息会导致两个 .MSI 获得新行为.

Now I have a second Visual Studio 2008 Wix 3.0 Project for the .MSI of another application and it needs to ask the user for the same information. I can't seem to figure out the best way to share the file so that changing the information requested will result in both .MSIs getting the new behavior.

老实说,我不知道合并模块、.wsi(包含)或 .wixlib 是否是正确的解决方案.我本来希望找到一个简单的例子来说明有人这样做,但到目前为止我失败了.

基于 Rob Mensching 的 wixlib 博客条目,wixlib 可能是答案,但我仍在寻找如何执行此操作的示例.

Based on Rob Mensching's wixlib blog entry, a wixlib may be the answer, but I am still searching for an example of how to do this.

推荐答案

我对 .wixlib 选项非常满意.一旦我理解了 .wixlib 是什么,我只用了几分钟就完成了.
我做了以下事情:在 VS2008 中,添加->新建项目...名为 SQLDialog 的WiX 库项目"类型.使用空的 元素创建库 .wxs 文件.我将现有对话框(在我的主WiX 项目"中)中的 UI 元素复制到 Fragment 元素中:

I am quite pleased with the .wixlib option. It took me just a few minutes to do once I understood what a .wixlib was.
I did the following: In VS2008, Add->New Project... of type "WiX Library Project" named SQLDialog. A Library .wxs file is created with an empty <Fragment></Fragment> element. I copied the UI element from my existing dialog (in my Main "WiX Project") into the Fragment element:

<Fragment>
  <UI>
    <Dialog Id="SQLServerPromptingDlg" ... Title="SQL Server Information" ...>
      <Control Id="Next" Type="PushButton" ... Text="!(loc.WixUINext)" />
      ...
    </Dialog>
  </UI>
</Fragment>

我在 VS2008 的 Release Build 配置中添加了 wixlib 项目.我从主 WiX 项目中删除了 SQLDialog.wxs 文件,而是引用了 SQLDialog wixlib 项目.
当我重新编译解决方案时,主要的 WiX 项目与以前完全一样!!甜!

I added the wixlib project to the Release Build configuration in VS2008. I deleted the SQLDialog.wxs file from the Main WiX Project and referenced the SQLDialog wixlib project, instead.
When I recompiled the solution, the Main WiX project worked EXACTLY THE SAME AS BEFORE!! Sweet!

然后我从我的另一个 WiX 项目中引用了 SQLDialog wixlib 项目并从那里使用了它.工作得很好!Build Server 很高兴,因为共享的 .wixlib 项目是它正在编译的解决方案的一部分.因此,就我们的目的而言,我认为这比共享"目录要好.没有冒犯鲍勃.我很欣赏你的想法.

Then I referenced the SQLDialog wixlib project from my other WiX Project and utilized it from there. Worked great! Build Server is happy because the shared .wixlib project is part of the solution it is compiling. So, for our purposes, I think this was better than a "shared" directory. No offense Bob. I appreciate your thoughts.

这篇关于如何在两个 WiX 项目中共享 WiX 片段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆