tags:

views:

678

answers:

4

I have a shared dll, we’ll call it Utility.dll that is installed by multiple products. In my WIX file I install Utility.dll as a separate component. Now version 2.0 of the Utility.dll references an additional dll, UtilityUtility.dll which will need to be installed alongside.

For my first attempt integrating UtilityUtility.dll I created a new WIX component containing the new dll.

This causes problems in the following scenario

1) User installs Product 1 { Utility.dll 1.0 }
2) User installs Product 2 { Utility.dll 2.0, UtilityUtility.dll 2.0 }
3) User uninstalls Product 2 { Utility.dll 2.0 }

Now when a user uses the Utility.dll it will fail when it can’t find the referenced UtilityUtility.dll

This led me to add UtilityUtility.dll to the original component which prevents UtilityUtility.dll from being removed in the previous scenario but comes with its own issue.

1) User installs Product 1 { Utility.dll 1.0 }
2) User installs Product 2 { Utility.dll 2.0, UtilityUtility.dll 2.0 }
3) User uninstalls Product 2 { Utility.dll 2.0, UtilityUtility.dll 2.0 }
4) User uninstalls Product 1 { UtilityUtility.dll 2.0 }

UtilityUtility.dll is orphaned as it does not get removed by the Product 1 uninstall (it did not exist in the component when it was originally installed).

Do I have any other options here?

Thanks

A: 

Can you reproduce the second issue? In theory after you install Product 2 component version becomes 2.0. After step 3 component version is still 2.0. When user uninstalls product 1 in step 4 Windows Installer knows how to remove both Utility.dll 2.0 and UtilityUtility.dll 2.0.

Update: I was wrong, sorry.

Pavel Chuchuva
@Pavel there is no such thing as "component version" in Windows Installer. The behavior described above is what I would expect.
Rob Mensching
I do have a repro.
+1  A: 

I'm not 100% certain... but I think adding the second .DLL to the original component is likely a "violation" of the component rules. Take a look at: http://blogs.msdn.com/robmen/archive/2003/10/18/56497.aspx

From what I gather from the Wix crowd the leading "best practice" is to have each file as an individual component.

What are your plans for upgrades (in msi terms: major, minor, patch)? If I recall correctly minor upgrades are not allowed to muck with component definitions. No idea about patches.

You might also want to worry about repair.

I would love to have the second dll in its own component but I need to prevent it from being removed in the first scenario step 3.I plan on doing major upgrades.
@summergoat: I think you might be out of luck then (see Rob Menshing comment). You might want to ask on the wix mailing list... they tend to be helpful and deeply knowledgeable about windows installer (this is not really a wix question... but a windows installer question).
+2  A: 

Unless you can update Product 1 (which I presume isn't completely possible), I think you are screwed. IMHO, the Component Rules are the worst thing about the Windows Installer. This link to an old blog post of mine sums up most of it. Your case is a bit different than what is described there but the results are expected.

I think you get to pick the lesser of two evils.

Rob Mensching
With the first scenario would a reinstall/repair of Product1 after the unistall of Product2 using REINSTALLMODE=a (or amus) repair the situation? I have a somewhat similar test project and it looks like the repair replaces the v2 DLL with the v1
Rob McCready
Yes, repairing Product1 with REINSTALLMODE=a would force all files in that package on the machine, potentially breaking any other shared files. "a" is a very brutal hammer to swing.
Rob Mensching
A: 

I have run into this problem myself. I agree with @rbobby and I further submit that the fact that you can envision this broken user scenario is proof that you are violating the rules. You should only update a shared component if it is fully and completely compatible. If Duck 2.0 doesn't quack or swim, make up a new name for it.

In your case, you have Utility.dll 1.0 and Utility.dll 2.0, but they are only the "same component" in that they do similar things in a different way. Utility.dll 2.0 should really be called UtilityPlus.dll 1.0.

Sorry, I know it's probably not the answer you wanted to hear, but engineering case is clear.

leo grrr