Archive: Problems running uninstaller before I do an install.


Problems running uninstaller before I do an install.
I use NSIS for a variet of products, but the one feature we'd like to add is that the uninstaller, for a previous product is run, *before* the new installation is started.

The following

CopyFiles /SILENT "$INSTDIR\uninstall.exe" "$TEMP\uninstall.exe"
ExecWait '"$TEMP\uninstall.exe" /KEEPCACHE /S _?=$INSTDIR'

So here's what happens, ExecWait runs the uninstaller, but then exits, and even after it exits, the uninstallation is still taking place, so when I run the installation phase, the product is in an incomplete installation state, as some files installed by the installer, are also being deleted by the uninstaller which is still running.

I've read the docs, and looked for help here, and I am using NSIS 2.24, and they say to use the _? commandline param. That using this will ensure that the uninstaller will be completed. But in my testing, this obviously isn't true.


I'd suggest update to the latest version.

Take a look at the included example makensis.nsi


hey dude, take a look in my script:

http://forums.winamp.com/showthread.php?s=&threadid=272368

it's working aight, it loads the uninstaller in case a previous installation is present, however it fails to restart the installer after it's done... yet to be solved:(

Originally posted by Shlomikalfa
hey dude, take a look in my script:
http://forums.winamp.com/showthread.php?s=&threadid=272368

it's working aight, it loads the uninstaller in case a previous installation is present, however it fails to restart the installer after it's done... yet to be solved:(
As already mentioned dude, all you have to do is to take a look at the included example makensis.nsi.
It is a real world installer which shows the way to go.

Re: Problems running uninstaller before I do an install.

Originally posted by 99999999
I use NSIS for a variet of products, but the one feature we'd like to add is that the uninstaller, for a previous product is run, *before* the new installation is started.

The following

CopyFiles /SILENT "$INSTDIR\uninstall.exe" "$TEMP\uninstall.exe"
ExecWait '"$TEMP\uninstall.exe" /KEEPCACHE /S _?=$INSTDIR'
Hi,

the problem is that you are trying to use the NEW uninstaller for the NEW version to do the uninstall of the PREVIOUS version.

So your product should write some entries in the registry
e.g.

HKLM Software\MyCompany\MyProduct Uninstall = $INSTDIR\uninst.exe

And perhaps version information e.g.

The newer version should try to read the registry for the old version info/uninstall key.

If it exists, use

ExecWait $UninstallString


to perform the uninstall of the former version BEFORE running into the Install section of the new installer.