InstallShield won't over-write a file during an upgrade

682 Views Asked by At

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

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:

RenameFile(FileName1, FileName2);

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

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.

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.

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

SH

1

There are 1 best solutions below

3
On

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.