How do I share a WiX fragment in two WiX projects?

这一生的挚爱 提交于 2019-12-04 09:37:54

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>

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!

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.

If it's just one file, a .wixlib might be overkill, as it requires another .wixproj to build it. What I do in cases like that is put the .wxs in a "shared" directory and add it to multiple projects using the "add link" drop-down in the "add existing item" command.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!