0

My application has one versioned file and many unversioned files. I want the behavior describe here which I expect to be the default behavior but I am not seeing that behavior.

Basically, an unversioned file should be replaced if unmodified and left alone if modified.

From the logs it appears that the install phase is doing exactly what I would expect. None of my unversioned files have been modified. For each file I get a message stating Overwrite; Won't patch (if the hash is different) or Won't overwrite; won't patch (if the hash is the same).

However, then when the remove phase runs (which is running in the default place, after install finalize) it removes all of my unversioned files.

My only guess as to why it might is because the file has a different GUID in each package but I thought I could regenerate file GUIDs every time I create the installer.

I realize I can change the remove phase to occur before the install happens but I would like the application to remain in place if the upgrade fails and so I was hoping to avoid this behavior.

Is there something I can do to prevent the uninstall phase from removing my files?

Pace
  • 41,875
  • 13
  • 113
  • 156
  • Though not finished yet, I am trying to summarize some common developer pit-falls when using MSI files here: [**How do I avoid common design flaws in my WiX / MSI deployment solution?**](https://stackoverflow.com/questions/45840086/how-do-i-avoid-common-design-flaws-in-my-wix-msi-deployment-solution). – Stein Åsmul Aug 25 '17 at 21:21

1 Answers1

2

Figured it out after a bit more stumbling around. It turns out there is a difference between providing the -gg flag to heat.exe which will generate a GUID when heat runs (a random GUID) and passing the -ag flag to heat.exe which will set the GUID to * when heat runs so the GUID can get generated (consistently) when candle runs.

If I pass -ag to heat.exe then I get consistent GUIDs and upgrade behaves correctly.

Pace
  • 41,875
  • 13
  • 113
  • 156