Reputation: 375
I'm creating an update setup files. In my initial installation, I have an EXE file which is called in [UninstallRun]. In the update, I want to permanently remove this EXE file but it seems to always throw the error "Some elements could not be removed" when I uninstall after the update.
To delete the EXE, I've tried deleting it during the update's [InstallDelete]
. This deletes the file, but the error message is still thrown when its uninstalled (even though all files have definitely been removed).
I tried replacing the EXE in the update and using the deleteafterinstall
flag, but that didn't make a difference.
If I don't do anything, and just install it, when I run the uninstaller, the EXE file is called, even though the update no longer contains the [UninstallRun]
section. So it looks like the initial installation's setup file is being used for the uninstallation part.
For the purposes of this project, I can't change the initial installation, so everything has to be done from the update installation. Is there a way to delete an existing file that was placed in an UninstallRun
section?
Upvotes: 3
Views: 332
Reputation: 13030
The issue is that the [UninstallRun]
entry from the prior install has already been registered in the uninstall log, so simply removing it from your script won't stop it taking effect, and deleting the file will by default make it generate that error since (presumably) some required uninstall task didn't happen since the file was missing.
Did you remember to put a RunOnceId
on the [UninstallRun]
entry in the original installer? If so, you can put a "replacement" entry using the same id. You'll still have to make it point at an exe, but you can make it a no-op one, or (better) use Flags: skipifdoesntexist
and point it at the one you've removed.
If you didn't use a RunOnceId
, then there isn't any way to override the previous entry. You'll just have to put in a dummy exe file that does nothing.
Upvotes: 4