How can I make sure a downgraded library is instal

2019-07-01 14:48发布

问题:

I have an MSI that setups my application. It has a single component and installs only to %PROGRAMFILES% (no shared binaries). Simplified, it looks like this

Msi file, Monday build:
    Program.exe  (v1.0.0)
    ThirdPartyLibrary.dll  (v2.0.1)

Now, if I discover a bug in the program caused by my upgrade of the ThirdPartyLibrary dll from v2.0.0 to v2.0.1, and thus revert the reference to v2.0.0, it seems my MSI doesn't automatically replace the file in the installation directory?

Msi file, Tuesday build:
    Program.exe  (v1.0.0)
    ThirdPartyLibrary.dll  (v2.0)  <- downgraded

What is the best practice here to ensure that the program folder always contains exactly the binaries in my setup? Should I a) wipe everything from the setup directory before copying the new files? Is there an option (in Wix) I can use that makes the msi force an overwrite of all files regardless of version?

What if I remove a file from the setup (a file that would cause errors if present at runtime), then the only way to have a working program after the setup, would be if it deleted all files first?

回答1:

You can use a msi trick. In the File table in the msi database edit the Version column and enter a higher version, 3.0 for example. This way you will take advantage of the file versioning rules.