为什么我的新Windows Installer文件(MSI)不能在旧版本的MSI上正确安装?

时间:2021-11-28 22:55:22

Symptoms

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

我有新创建的安装程序包(MSI),它安装了我的应用程序的新版本。

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

我有一个新的ProductCode用于我的安装,但我已经使UpgradeCode保持不变。

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

因此,当我执行新的MSI时,它首先正确卸载旧版本。甚至删除Program Files \ MyProduct目录。

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.

旧版本中各种dll和exes的版本号都搞砸了。旧的exe版本是4.11.1234。新exe的版本是4.5.1234。根据“文件版本控制规则”,新文件不会覆盖旧文件。我之间的问题是,当InstallFiles操作执行时,目标文件不再驻留在磁盘上。

Other Information

I'm targeting Windows Installer 3.1.

我的目标是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 个解决方案

#1


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

我假设你也改变了PackageCode和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."

“我之所以挠头,是因为当InstallFiles操作执行时,目标文件不再驻留在磁盘上。”

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.

是的,但是在文件被物理删除之前,MSI决定安装/不安装文件 - 当第一次通过InstallExecute序列时,当文件仍在硬盘驱动器上时,决定进行。

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.

另一种选择:您使用的是InstallShield吗?您可以选择在单个文件上设置两个属性中的一个来解决问题:1)始终覆盖,2)覆盖系统版本。 “Always Overwrite”将自动将版本号设置为65535.0.0.0,从而启用安装。 “覆盖系统版本”允许您输入自己的版本,高于实际文件版本,从而也可以启用安装。右键单击该文件,然后参见“属性”以设置这些选项。

#1


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

我假设你也改变了PackageCode和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."

“我之所以挠头,是因为当InstallFiles操作执行时,目标文件不再驻留在磁盘上。”

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.

是的,但是在文件被物理删除之前,MSI决定安装/不安装文件 - 当第一次通过InstallExecute序列时,当文件仍在硬盘驱动器上时,决定进行。

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.

另一种选择:您使用的是InstallShield吗?您可以选择在单个文件上设置两个属性中的一个来解决问题:1)始终覆盖,2)覆盖系统版本。 “Always Overwrite”将自动将版本号设置为65535.0.0.0,从而启用安装。 “覆盖系统版本”允许您输入自己的版本,高于实际文件版本,从而也可以启用安装。右键单击该文件,然后参见“属性”以设置这些选项。