11

I am new to using WiX so this my be a dumb question. I am trying to keep the GUID generated by the harvest tool (heat.exe) consistent for files that I am packaging. Everyone seems to say that as long as the file path and sub path remain same heat.exe will generate the same GUID for a file. Unfortunately, I am not seeing that behavior. My workflow is as follows.

Copy all the deliverable files to a staging directory during my build process. Then run heat.exe in the staging directory to generate the component fragment wxs file. Before I copy the file into the staging directory I clear all my old files.

I want to add the generated wxs file into my source control so that I can achieve minor upgrades. If my understanding is correct for me to achieve that I need to have consistent GUID across my builds so that I can track them.

The command line I use for generating the wxs file is as follows:-

c:\foobar\build\>C:\win32\wix-3.7.1224.0\heat.exe dir . -cg MyCG -dr INSTALLDIR -g1 -gg -nologo -sreg -suid -t C:\foobar\src\support\packaging\wix\foo.xslt -var var.foobarSource -out c:\foobar\src\support\packaging\wix\foo.wxs

What I see that the GUID generated are different during each run. Is there was a way for me to keep GUID consistent.

Rohan Kandwal
  • 9,112
  • 8
  • 74
  • 107
tuxalot
  • 313
  • 4
  • 11

1 Answers1

13

You should specify -ag flag.

-ag
Auto generate component guids at compile time, e.g. set Guid="*".

As long as your file paths are the same, generated GUID's will be the same for files.

Erti-Chris Eelmaa
  • 25,338
  • 6
  • 61
  • 78
  • Does this mean that I should remove the -gg option which implies generate guid now and use -ag instead. – tuxalot Dec 23 '13 at 18:39
  • If I use -ag flag is there way for me to list what the generated GUID were at compile time to verify that they remain the same. – tuxalot Dec 23 '13 at 18:52
  • 1
    Yes. -ag flag is used if you want to do minor upgrades. If you have used previously -gg flag, then switching to -ag flag wont help you anymore(if that's the case; you could write custom tool that processes your wxs to keep GUIDS consistent - you can read everything from MSI file). Note that Guid="*" on Component wont produce Guid randomly - it is calculated from the path. If you want to verify things, you should set up test environment and see how minor upgrades work. – Erti-Chris Eelmaa Dec 23 '13 at 19:57
  • Would the guids change if the top level path name changes. I mean if I am currently generating guids for a build directory c:\foo\build and it changes to c:\bar\build – tuxalot Dec 24 '13 at 00:29
  • 1
    No. The guids are fixed within the INSTALLATION dir, not the source one. Unless you change the place/folder where the files are installed on client's computer, they will be same. – Erti-Chris Eelmaa Dec 24 '13 at 21:30