31

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?

aherrick
  • 19,799
  • 33
  • 112
  • 188
  • WiX documentation will have a clear and easy-to-find answer on this. **If it does not**, you shouldn't be looking at that GUID (it's called undocumented) – sehe Apr 29 '11 at 12:59
  • 2
    But does WIX create a new GUID for every * every time I compile? How does it then link up that GUID? – aherrick Apr 29 '11 at 14:26
  • 1
    http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Auto-generated-vs-statically-assigned-GUIDs-td4670083.html – Isaiah4110 Sep 19 '13 at 02:26
  • This might help you clear your doubts. – Isaiah4110 Sep 19 '13 at 02:27
  • 1
    In addition to the answer below, try this article to clarify when a component GUID should be changed: [**Changing the component GUIDs in Wix**](http://stackoverflow.com/questions/1405100/change-my-component-guid-in-wix/1422121). – Stein Åsmul Apr 20 '15 at 03:07
  • If you want to patch an installation with a `*.msp` file then the `Product Id` must but be constant, so don't use a `*` in this case. – CAD bloke Jun 03 '18 at 00:38

7 Answers7

51

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.

Bob Arnson
  • 21,377
  • 2
  • 40
  • 47
  • 1
    great thanks. so what does that mean for the Product ID auto generating then? What is the GUID for the Product ID used for? In other words, what are the pros/cons of generating a unique Product ID every build? – aherrick Apr 29 '11 at 18:05
  • 1
    @aherrick Product codes must change to use major upgrades. See Yan's answer for a link with details. – Bob Arnson Apr 29 '11 at 18:52
  • So if I version my WIX installer from 1.0.0 to 2.0.0 (major upgrade?) and keep my Product ID with a * what would that then mean? Still not sure i'm fulling grocking this... – aherrick Apr 30 '11 at 10:18
  • @aherrick You don't need to change the first version field -- see http://www.joyofsetup.com/2008/12/29/neither-more-nor-less/. See http://www.joyofsetup.com/2010/01/16/major-upgrades-now-easier-than-ever/ for how to author major upgrades. – Bob Arnson Apr 30 '11 at 19:09
  • 1
    Bob- Thanks but this doesn't really answer my question. I want to accept this answer but cannot quite yet. If a new GUID is generated every time the installer is recompiled, how is that GUID then linked to other versions of the installer? Or is it linked VIA the Upgrade Code GUID? If the link is the Upgrade Code GUID as I expect, what is the purpose of the randomly generated Product Id GUID? – aherrick May 02 '11 at 13:34
  • 1
    http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Auto-generated-vs-statically-assigned-GUIDs-td4670083.html – Isaiah4110 Sep 19 '13 at 02:50
  • 1
    Note that with a value of `\*` for component GUID my candle process (run from cmd) told me the value is invalid but using `*` worked. Both worked when invoked via Visual Studio 2017. – BNT Sep 20 '18 at 12:32
  • This is done by the Microsoft.Tools.WindowsInstallerXml.Binder class in the SetComponentGuids method: https://github.com/wixtoolset/wix3/blob/develop/src/tools/wix/Binder.cs#L5657 – dalle Nov 27 '19 at 09:59
8

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).

Umesh
  • 166
  • 2
  • So what is the benefit/problems that come with having a random Product ID generated on every build verses keeping one GUID? Basically nothing? – aherrick May 03 '11 at 16:36
  • To make it more clear because it took me forever to understand, if you want that only one version of your product is present at any time on the target computer, all the versions must have the same `UpgradeCode` ! – Vincent Fourmond Mar 12 '21 at 06:46
4

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

habakuk
  • 2,712
  • 2
  • 28
  • 47
3

This quick guideline can help you. Be sure the check the MSDN links referenced from that article for better understanding how it works.

Yan Sklyarenko
  • 31,557
  • 24
  • 104
  • 139
1

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

Umesh
  • 166
  • 2
  • Right thanks, so then what is the purpose of the Product ID GUID? That is the main thing I am still confused on here. – aherrick May 03 '11 at 13:29
0

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
David Clarke
  • 12,888
  • 9
  • 86
  • 116
0

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.

Nilaksha Perera
  • 715
  • 2
  • 12
  • 36