InstallShield在升级期间不会覆盖文件

时间:2021-03-05 22:40:06

In my OnFirstUIAfter function, I rename a file that was just installed, using:

在我的OnFirstUIAfter函数中,我使用以下命令重命名刚刚安装的文件:

RenameFile(FileName1, FileName2);

In my OnMaintUIAfter function, I install FileName1 again, but it needs to over-write FileName2, just as it did in the initial install. If I simply use:

在我的OnMaintUIAfter函数中,我再次安装FileName1,但它需要覆盖FileName2,就像在初始安装中一样。如果我只是使用:

RenameFile(FileName1, FileName2);

Nothing happens. I still have both files in the INSTALLDIR, and FileName2 is out of date.

什么都没发生。我仍然在INSTALLDIR中有两个文件,并且FileName2已过期。

Believing that there's a problem with the installer script not being able to rename an existing file, I have since determined to delete the file prior to the rename.

我相信安装程序脚本无法重命名现有文件存在问题,因此我决定在重命名之前删除该文件。

DeleteFile(FileName2);
RenameFile(FileName1, FileName2);

And still nothing happens. Both files are still in the INSTALLDIR.

但仍然没有任何反应。这两个文件仍然在INSTALLDIR中。

Keep in mind that FileName2 is not a file being installed by any previous install. All the installs install FileName1 and then rename it to FileName2.

请记住,FileName2不是任何先前安装所安装的文件。所有安装都安装FileName1,然后将其重命名为FileName2。

Any words of wisdom? I'm completely out of ideas.

任何智慧的话?我完全没有想法。

SH

SH

1 个解决方案

#1


2  

My best words of wisdom would be to stop writing custom actions. Learn the component rules and file versioning rules and let MSI do the heavy lifting for you. Out of process custom actions will only muddy the waters.

我最好的智慧之词就是停止编写自定义动作。了解组件规则和文件版本控制规则,让MSI为您完成繁重的工作。过程中的自定义操作只会使水域变得混乱。

#1


2  

My best words of wisdom would be to stop writing custom actions. Learn the component rules and file versioning rules and let MSI do the heavy lifting for you. Out of process custom actions will only muddy the waters.

我最好的智慧之词就是停止编写自定义动作。了解组件规则和文件版本控制规则,让MSI为您完成繁重的工作。过程中的自定义操作只会使水域变得混乱。