Let's say I generate my WIX XML file with a Product Id of *. Also for each Component GUID I use a *.
<Product Id="*" Name="xxx" Language="1033" Version="1.0.0.0" Manufacturer="xxx" UpgradeCode="xxx">
Behind the scenes is the * spinning a unique GUID each time I compile my WIX Installer? Let's say I have version 1.0.0 installed a machine. Then I recompile my WIX Installer to version 1.0.1.
When I go to install 1.0.1 how does WIX know that 1.0.0 is already installed and thus will remove all files/registry entries and install 1.0.1?
Should I be using * from GUID or should I have a unique ID/GUID in my WIX XML configuration?
Product/@Id="*"
randomly generates a new GUID, which is sufficient for product codes. Component/@Guid="*"
calculates a GUID that stays the same as long as your target path stays the same, which is necessary to comply with component rules.
Product ID (ProductCode) uniquely identifies everything in the installer package as a particular product. When you search to see if a previous version is installed search is performed on the Upgrade Code. For all items found with the particular Upgrade code Installer will note each of the Product Codes as different incarnations of the same product. So you can say a different product code of same upgrade code identifies different incarnations (versions if you will, of the same product).
This quick guideline can help you. Be sure the check the MSDN links referenced from that article for better understanding how it works.
From http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Auto-generated-vs-statically-assigned-GUIDs-td4670083.html:
If you want to ship updates as MSP's (Small Update or Minor Upgrade in
Microsoft terminology) don't use auto-generated GUIDs. If you're only
ever going to ship updates as MSI's (Major Upgrades) you need to change
the Product Code every time anyway so auto-generating is fine. See ->
http://msdn.microsoft.com/en-us/library/aa370579.aspx
What links other versions to new version is the upgrade code. That should not change for the same product assuming you want to use the upgrade functionality. Otherwise it is almost like each version is a different product
This may be somewhat misguided but I did have a lot of files I was importing as components into a new WiX Product.wxs
file. I discovered after I had created all the components with Guid="*"
that when trying to build the installer, WiX reported the following error for each component:
The component 'AjaxControlToolkit.dll' has a key file with path 'TARGETDIR\ajaxcontroltoolkit.dll'. Since this path is not rooted in one of the standard directories (like ProgramFilesFolder), this component does not fit the criteria for having an automatically generated guid.
I used the following PowerShell script to assign a new guid to each component. Be aware that this script will modify the Product.wxs
file directly and a backup of the file should be kept in case something goes wrong:
(Get-Content Product.wxs) |
Foreach-Object { $guid = [guid]::NewGuid().ToString(); $_ -replace 'Guid="\*"',"Guid=""$guid"""} |
Out-File Product.wxs
You must set a value to the property "UpgradeCode" in your product element. Which must be unique and must remain the same for all of your future builds for the setup. The upgrade code is responsible for letting an installations upgrade or not upgrade depending on the setup versions being executed.
ie:-
<Product Id="*" Name="My Application" Language="1033" Version="1.1.0" Manufacturer="Myself :p" UpgradeCode="{561DA858-5398-4B87-8F3A-8B8BB12650F6}">
NOT maintaining a static upgrade code will result duplicating identical installations.