MSI: Fixing different component GUIDs for the same

2019-07-29 20:21发布

问题:

I've inherited an installer with a fairly long history. In a few versions, component GUIDs were not tracked properly, resulting in different component GUIDs for a given file.

v1.0: C:\Program Files\Foo\Foo.exe {GUID_A}
v2.0: C:\Program Files\Foo\Foo.exe {GUID_B}
v3.0: C:\Program Files\Foo\Foo.exe {GUID_B}

This obviously violates component rules, and requires early sequencing of RemoveExistingProducts to avoid absent files after an upgrade.

Each new version installs as a Major Upgrade. It is expected that the latest version will cleanly upgrade any previous version.

Question: Is there any way to reset or salvage this scenario going forward? I'd like to schedule RemoveExistingProducts after InstallFinalize without causing destruction.

(I've been using heat.exe's deterministic GUIDs since I got ahold of the project. Best feature ever.)

回答1:

To switch to a late major upgrade, you have to ensure you're only upgrading from versions that adhere to the component rules. So in this case, you have to block upgrades from v1.0.