tags:

views:

264

answers:

2

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.

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.

I honestly can't tell if a merge module, an .wsi (include) or a .wixlib is the right solution. I would have hoped to find a simple example of someone doing this but I have failed thus far.

Edit: 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.

A: 

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.

Bob Arnson
Thanks for the thoughts, Bob. I considered this approach, but I prefer something that is more intuitive when looking at the solution. Also, I don't want to create any new challenges for the build environment.
Randy Eppinger
A: 

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.

Randy Eppinger