Why doesn't my new Windows Installer file (

2019-01-25 23:33发布

问题:

Symptoms

I have newly created setup package (MSI) that installs a new version of my application.

I have a new ProductCode for my installation but I have left the UpgradeCode the same.

So when I execute the new MSI it first uninstalls the old version correctly. Even the Program Files\MyProduct directory is removed.

But after uninstalling the old version the installer then only partially installs the new version. If I repair the damaged new installation (Using Add Remove Programs->Modify Installation->Repair), everything is fixed.

If I first uninstall the old version using Add Remove Programs and then install the new version everything works great. The problem only occurs when I install the new version over top of the old version.

Possible Cause

The version numbers for various dlls and exes in the old version were messed up. The old exe version is 4.11.1234. The version for the new exe is 4.5.1234. According to the "File Versioning Rules" the new file will not overwrite the old file. The reason why I am scratching my head is that by the time the InstallFiles action executes the destination file no longer resides on the disk.

Other Information

I'm targeting Windows Installer 3.1.

My installation execution sequence is roughly:

...
InstallValidate
RemoveExistingProducts
InstallInitialize
...
InstallFiles
...
InstallExecute
InstallFinalize
....

If this context doesn't make the question clear, let me know...

Thanks!

回答1:

I'm assuming you also changed the PackageCode and ProductVersion?

"The reason why I am scratching my head is that by the time the InstallFiles action executes the destination file no longer resides on the disk."

Yes, but MSI makes the decision to install/not install files before the files get physically removed -- that decision is made during the 1st pass through the InstallExecute sequence, when files are still on the hard drive.

I had the problem you have, and I was able to solve it by changing the files' version to be newer than those already on the hard drive -- can you do that?

Another option: Are you using InstallShield? You can choose to set one of two properties on individual files that would solve the problem: 1) Always Overwrite, 2) Override System Version. "Always Overwrite" will automatically set the version number to 65535.0.0.0, thus enabling installation. "Override System Version" allows you to enter in your own version, higher than the real file version, and thus also enabling installation. Right-click on the file and see Properties to set these options.