4
votes

I'm having trouble understanding how to cleanly remove an obsolete file that used to be part of my Inno Setup, but is no longer. I'd greatly prefer that it not be in the destination folder when updating to the new version of my product.

I tried removing it in the [Run] section. That worked, but when I uninstalled, I got a dialog box saying "Some elements could not be removed. These can be removed manually".

It'd be nice not to have to do a complete uninstall of the old version before installing the new version. I just want the new installer to remove one obsolete file when it runs.

Is there a way of tagging the file as obsolete? I've looked at Inno's documentation, but couldn't find anything.

Any help would be greatly appreciated...thanks.

1
Proper way would be to use the [InstallDelete] section, but it would show the page that the file could not be closed if the file is in use and that seems you don't want... - TLama
Gave that a go and I'm getting the same result: upon uninstalling the product, I get a "Some elements could not be removed..." message. Looks like the only way to do this is uninstall the whole thing before installing the update. - user3011976
Still there's a backdoor by calling MoveFileEx with the MOVEFILE_DELAY_UNTIL_REBOOT flag specified explicitly. That may register that deletion for the next reboot without the need of telling that to user. - TLama

1 Answers

1
votes

It turns out that if you remove a file that used to be part of your installation during an update, Inno will display the error message when uninstalling the product. Therefore, the only way to handle this is to completely uninstall the previous version as part of the update to the new version.