How to share a WiX fragment in two WiX projects?

We have a WiX fragment in the SomeDialog.wxs file that asks the user for some information. It refers to another fragment in the InstallerUI.wxs file, which controls the order of the dialog. Of course, Product.wxs is our main file. It works great.

Now I have a second Visual Studio 2008 Wix 3.0 project for the .MSI of another application, and it should ask the user to get the same information. It seems I can’t find a better way to share the file, so changing the requested information will cause both .MSI to get a new behavior.

I honestly can’t determine if the .wsi (include) or .wixlib merge module is the right solution. I would hope to find a simple example of whoever does this, but I still have not been able to.

Edit: Based on Rob Mensching's wixlib blog entry , may be wixlib's answer, but I'm still looking for an example of how to do this.

+4
source share
2 answers

I am very pleased with the .wixlib option. It took me just a few minutes to figure out what .wixlib is.
I did the following: In VS2008, Add-> New Project ... of the type "WiX Library Project" named SQLDialog. The library's .wxs file is created using an empty <Fragment></Fragment> element. I copied the user interface 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 instead referred to the SQLDialog wixlib project.
When I recompiled the solution, the main WiX project worked EXACTLY VERY BEFORE! Cool!

Then I referenced the wixlib SQLDialog project from my other WiX project and used it from there. Excellent! The build server is happy because the common .wixlib project is part of the solution that it compiles. Therefore, for our purposes, I think that it was better than the "general" catalog. No offense Bob. I appreciate your thoughts.

+7
source

If this is only one file, .wixlib may be full, since another .wixproj is required to create it. What I do in such cases, puts .wxs in the "shared" directory and adds it to several projects using the "add link" drop-down menu in the "add existing item" command.

+1
source

Source: https://habr.com/ru/post/1308816/


All Articles