26

My scenario is this: I want the installer to completely remove the old version (all files except those created by the application during its lifetime) and replace it with the new version.

In my Wix script I use auto-generated GUID (asterisk) for Product ID and Package ID, while I use my own GUID for UpgradeCode which always stays same. What I'm not sure if I can safely use auto-generated GUID (asterisk) for Component tags as well, with respect to my scenario?

So far I was using NSIS. I wanted to try Wix but got a little doubt since people on forums say it will take you about 30 days to learn it while one can start off with NSIS in 1-2 days. However, for a standard installation that typical users need, it took me 2 days to get a really good installer package using Wix. If you have a little background in xml you should probably have no worries. Thanks to Rob and all the other contributors for creating the Wix!

BartoszKP
  • 34,786
  • 15
  • 102
  • 130
Marcus Frenkel
  • 691
  • 10
  • 19
  • Here is some general information on the component guids - i.e. when they should be changed and not: https://stackoverflow.com/questions/1405100/change-my-component-guid-in-wix/1422121#1422121 – Stein Åsmul Jul 15 '17 at 23:16
  • "A multi-file component isn’t suitable for generated GUIDs, so it requires an explicit GUID but can still take advantage of default component ids:" http://www.joyofsetup.com/2009/12/31/simplifying-wix-component-authoring/ – CAD bloke May 12 '18 at 23:39

1 Answers1

32

Yes, the auto-guid Component/@Guid are safe. They are done very specially to ensure that the GUID is generated in a way that is stable across releases for that Component such that the Component Rules are not violated.

Additionally, if you do not share Components with other Products and you always use major upgrades and you schedule the major upgrade early, then you don't have to worry about Component GUIDs much at all, because the two Component GUID definitions will never be on the machine at the same time. For example, the defaults for the MajorUpgrade element give you exactly this:

<MajorUpgrade DowngradeErrorMessage='A newer version of [ProductName] is installed.' />

So, the answer is, "Yes". :)

Rob Mensching
  • 33,834
  • 5
  • 90
  • 130
  • 10
    Thanks Rob! I really appreciate that the original author of Wix finds time to answer user questions here. – Marcus Frenkel Apr 22 '13 at 08:45
  • 1
    No problem. Took us a long time to get to a algorithm that is stable for Component Guids. Huge win for everyone once it worked. :) – Rob Mensching Apr 22 '13 at 11:06
  • 1
    So what if you have an older version of an installer which uses explicit GUIDS? Is it then safe to change it to use `*` instead? (or rather, what are teh cases where that would cause problems?) – jalf Oct 10 '13 at 09:32
  • You'd get new GUIDs and would need to make sure you don't violate the Component Rules. – Rob Mensching Oct 10 '13 at 22:57
  • 1
    regarding the side note "schedule the major upgrade early" see problems discussed here: [4227456](http://stackoverflow.com/questions/4227456/windows-installer-deletes-versioned-file-during-product-upgrade-instead-of-down) – Opmet Nov 18 '13 at 14:10