Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MSI/WiX - Assigning Component GUID's during Multiple Instance Transforms

Using WiX 3.5, I have an MSI with instance transforms allowing me to install the software on the same machine with different product names. To do this, I have a "hard-coded" list of product id's and names in the .wxs file defined conditionally. However, I have only the single Feature-ComponentRef definition that includes both file and non-file resources.

Installation appears to work fine, but uninstalling the instances demonstrates the behaviour mentioned in these two sources:

http://msdn.microsoft.com/en-us/library/aa367797(v=VS.85).aspx

and

http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Multiple-Instance-Transforms-Walkthrough-Proposed-Simple-Addition-to-WiX-to-Make-Them-Easier-td708828.html

Specifically, none of the non-file resources (in this case, registry entries) get uninstalled save the very last instance of my application. (i.e., if I uninstall in this order: instance1, instance2, and instance3 - only instance3's non-file resources are removed.

I am presuming this is related to not having unique GUID's for nonfile components (whereas this isn't an issue for file components)

So, I was wondering whether a valid approach would be to define a single .wxs file with one product id, name and one set of features, but have a custom bootstrapper generate new GUID's for the product and non-file components which then get inserted into the MSI database at runtime? i.e., Then when it comes time to uninstall or update, I would query the registry for installed instances and retrieve their GUIDs then.

This would permit instances to be created at runtime rather than hardcoded in the .wxs in advance, and to be uninstalled cleanly.

Does that make sense? Will Burn make everything better? :)

like image 951
ayang Avatar asked Feb 18 '11 21:02

ayang


1 Answers

As of version v3.6.1511.0, there is now a "MultiInstance" attribute for components. This allows a guid to be generated on the fly for each instance as per Josh Rowes suggestion in his post to the WiX mailing list (see the link in the OP). I have tested and this works correctly to cause registry data to be removed when the current instance is uninstalled, and not when the LAST instance is uninstalled.

like image 124
Eric H Avatar answered Sep 28 '22 16:09

Eric H