Uninstall Prior Version with Different App Name

330 views
Skip to first unread message

Chris Tietgen

unread,
Jun 21, 2022, 1:25:24 PM6/21/22
to innosetup
I have a prior installer created with InnoSetup that has an AppName=File Queue Upload Client and then created a new installer where the AppName=File Queue Uploader

Is there a way for the new installer to uninstall that prior version, then install the new version? Both apps will live in the same install folder. I am simply wanting to change the AppName in the ISS file and Control Panel > Add/Remove Programs.

Jernej Simončič

unread,
Jun 21, 2022, 1:29:16 PM6/21/22
to Chris Tietgen on [innosetup]

On Tuesday, June 21, 2022, 19:25:24, Chris Tietgen wrote:


Is there a way for the new installer to uninstall that prior version, then install the new version? Both apps will live in the same install folder. I am simply wanting to change the AppName in the ISS file and Control Panel > Add/Remove Programs.

Just set the AppId to the old AppName, Inno will then treat it as an upgrade while changing the display name.

 

-- 
< Jernej Simončič ><><><><>< https://eternallybored.org/ >


It won't work.
       -- Jenkinson's Law

Chris Tietgen

unread,
Jun 21, 2022, 1:54:39 PM6/21/22
to innosetup
Just to make sure I am understanding, even if the old installer didn't use AppId, adding it to the new installer with the old installer's AppName, it would handle my scenario?

If so, thanks! I will give it a try.

Jernej Simončič

unread,
Jun 21, 2022, 2:09:33 PM6/21/22
to Chris Tietgen on [innosetup]

On Tuesday, June 21, 2022, 19:54:39, Chris Tietgen wrote:


Just to make sure I am understanding, even if the old installer didn't use AppId, adding it to the new installer with the old installer's AppName, it would handle my scenario?

Correct. If AppId isn't set, AppName is used instead.

 

-- 
< Jernej Simončič ><><><><>< https://eternallybored.org/ >


At any level of traffic, any delay is intolerable.
       -- Bruce-Briggs's Law of Traffic

Chris Tietgen

unread,
Jun 22, 2022, 4:53:22 PM6/22/22
to innosetup
I don't think what you suggested is working the way I wanted, so let me explain a little better.

At work we created a C# desktop app that uploads files to our system. This tool is very old and installs into the C:\Program Files (x86) folder, which sometimes causes issues because it creates files and if the User doesn't have the correct permissions, those files won't be created. Ideally, we'd code the app to use the User Data folders to store these files, but we can't make that change right now, so I was looking for a way to change our InnoSetup project to remove the prior version, no matter where it's installed, then install the new version into a completely different folder, typically right on the C:\ drive, which isn't ideal, but it works.

The older installer had an AppName of "File Queue Upload Client" and the new installer has an AppName of "File Queue Uploader". Not a major change, but still a change. Also, the new installer contains a new DefaultDirName setting, as mentioned above.

When I changed the new installer to set the AppId equal to the old installers AppName of "File Queue Upload Client" and ran the new installer, as you suggested, it simply installed the new app into the new DefaultDirName location and shows as a separate app in Control Panel > Add/Remove Programs. It never touched the old install.

After searching online I did find some examples that used a GetUninstallString method and  UnInstallOldVersion method to determine the prior install details, then uninstall it silently, but I wasn't able to wrap my brain around what the GetUninstallString was doing to determine the old version to uninstall.

Is there something else I am missing with the solution you suggested or should I be using the the other method I linked above?

Wilenty

unread,
Jun 22, 2022, 6:58:34 PM6/22/22
to innosetup
Hello Chris,
I saw above mentioned examples from:
https://stackoverflow.com/questions/2000296/inno-setup-how-to-automatically-uninstall-previous-installed-version
about "How to automatically uninstall previous installed version?"

But I'll show you how I would do it. In general users on StackOverflow use the "CurStepChanged(CurStep: TSetupStep);" procedure, but in InnoSetup is special function for that occasions: "Function PrepareToInstall(var NeedsRestart: Boolean): String;", where you can halt the user if need. Please check attached example, because I don't feel the need to post its source in this message. And I hope that minimum working example is much better than waste the time to copy-paste the code from this message. ;)

Greetings,
Wilenty
AldAppNewApp.iss

Chris Tietgen

unread,
Jun 23, 2022, 8:26:13 AM6/23/22
to innosetup
Thanks, Wilenty, I will give this a try.
Reply all
Reply to author
Forward
0 new messages