Reputation: 3638
When should I change or not change my component GUID in WIX? The Microsoft SDK information is confusing.
Glytzhkof edit: To clarify, the question deals with when a component GUID should be changed for an MSI component. A component can change with aspects such as: changed destination path, addition or removal of files to/from the same component, addition of registry data etc... This causes problems with regards to the so called component referencing, i.e the best practice for creating components in MSI.
Upvotes: 35
Views: 22797
Reputation: 42136
The overall concept of MSI is that there is a 1:1 mapping between a component GUID (unique identifier) and an absolute path (install location / key path). The full path, including file name if any (a directory can be the key path for a component). See update below for a new Wix feature to deal auto-magically with this.
Rob Mensching (WiX author):
More on Component Rules:
I use some simple rules to deal with the overly complex and rather counterintuitive component rules (especially for developers as opposed to deployment specialists):
SampleDriver.cat
, SampleDriver.inf
, SampleDriver.sys
, SampleDriver.cer
. They must all match as a "unit" for deployment.Some samples:
UPDATE:
Auto Component-GUIDs: WIX now has a new
auto-generate component GUID
feature thatcalculates a GUID
as long as the target path stays the same. I have not tried this out to be honest, but many seem to use it without problems, andRob Mensching (Wix author) states it is safe for normal use
. As a concept I highly recommend this since it features some auto-magic and shields you from some complexity.Minimal WiX Markup: Also note that you can leave out a lot of source attributes from your Wix xml file and rely on Wix defaults instead of hard coding values.
Upvotes: 53
Reputation: 35901
You never change the Component/@Guid. You also never change the set of Resources (File, RegistryKey, Shortcut, TypeLib, etc.) in the Component. When you have a new Resource, you must create a new Component with a new @Guid. The really tricky part is that new Component can have no overlap (think file path, or registry key path, or typelib, etc.) with the old Component.
These are basically the Component Rules, check out: https://robmensching.com/blog/posts/2003/10/18/component-rules-101/.
Upvotes: 19
Reputation: 23759
Have a look at the WiX Tutorial, The Files Inside, for a detailed explanation on component rules. Basically, it says you never change the GUID of a component, since that means orphaning the old component and creating a new component.
Upvotes: 0