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.
To generate GUIDs use the guidgen tool that ships with Visual Studio, generally located under Tools > Create GUID menu, or the GuidGen.com site. GUIDs generated this way will work fine in WiX, however since they are in mixed case they may cause issues if you share them with users of other, non-WiX tools.
The KeyPath for a Component is a single resource that the Windows Installer uses to determine if a Component "exists" on a machine.
The Fragment element is the building block of creating an installer database in WiX. Once defined, the Fragment becomes an immutable, atomic unit which can either be completely included or excluded from a product.
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. 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With