Pace
Pace

Reputation: 43957

Wix major upgrade removing unversioned files

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?

Upvotes: 0

Views: 419

Answers (1)

Pace
Pace

Reputation: 43957

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.

Upvotes: 2

Related Questions