On Saturday, June 4, 2022, 21:28:35, Ahnaf Mahmud wrote:
I would like to seamlessly update the installations of versions older than 1.3. One way I can check if the older version is installed is by checking if the uninstall.exe file is present (the uninstallation executable name for Inno is different so that's why I was thinking of this), and then do a silent uninstall before proceeding with the new installation. But I only found documentation for running programs after the installation is complete. I need it to be done before.
There are two ways you can do this:
- run the old uninstaller silently from the CurStepChanged(ssInstall) event function in [Code]
- use [InstallDelete] and [Registry] sections to delete the old uninstall info during install (use deletekey and/or deletevalue flags in [Registry])
The second one is a bit more manual work, but will let your install run faster. You have to remove the old uninstall info from Registry, because the uninstall key that Inno creates always has _is1 appended, so you will not be able to make it identical to the uninstall key created by NSIS.
On Sunday, June 5, 2022, 23:16:01, ip18 wrote:
1. I want to uninstall silently using uninstall.exe /S. But not sure how to do that in the code.
Exec(ExpandConstant('{app}\uninstall.exe'), '/S', '', SW_HIDE, ewWaitUntilTerminated, ErrorCode);
2. The installer doesn't wait until the uninstaller is finished. I did a workaround by making the installer wait for 10 seconds before continuing but I don't think that's ideal.
This depends on how the NSIS uninstaller works – nearly all uninstallers copy themselves to %TEMP%, and then re-run from there; if the original .exe exits immediately (instead of waiting for a signal from the child process), there's no easy way to wait for the uninstaller to finish.
I suggest you don't run the old uninstaller, and instead delete it with [InstallDelete], and remove the old uninstall registry info with [Registry] instead, this way you'll avoid the whole problem.
When I first created my application, I used NSIS to create the installer for distribution. However, in the upcoming update of my application, version 1.3 I have made some changes to the application itself and as part of the changes I have switched to using Inno Setup.I would like to seamlessly update the installations of versions older than 1.3. One way I can check if the older version is installed is by checking if the uninstall.exe file is present (the uninstallation executable name for Inno is different so that's why I was thinking of this), and then do a silent uninstall before proceeding with the new installation. But I only found documentation for running programs after the installation is complete. I need it to be done before.
On Monday, June 6, 2022, 22:23:45, Wilenty wrote:
"I suggest you don't run the old uninstaller, and instead delete it with [InstallDelete], and remove the old uninstall registry info with [Registry] instead, this way you'll avoid the whole problem."
Why?
Because it avoids the whole problem with having to figure out when the NSIS uninstaller has finished (and can be done without needing to use [Code] at all).