Allowing Same Application Install

293 views
Skip to first unread message

Federico Felman

unread,
Oct 20, 2022, 8:47:27 AM10/20/22
to innosetup
Hello.
I've been working on a new installer. I've started with the basic wizard.
The first time I run it everything is fine, the second one it should not allow me isntall it since it's already installed. Instead of that it doesn't allow me to select the directory and overwrite the previous install.
For what I know if it uses the same App ID (as I do) it should not allow the user to install twice, or at least warn them that they are going to be "repairing" the previous installation.
This is pretty basic,  sorry if it bothers you guys.

Thanks for this great project!

Gavin Lambert

unread,
Oct 20, 2022, 5:43:47 PM10/20/22
to inno...@googlegroups.com
On 21/10/2022 01:47, Federico Felman wrote:
> I've been working on a new installer. I've started with the basic wizard.
> The first time I run it everything is fine, the second one it should not
> allow me isntall it since it's already installed. Instead of that it
> doesn't allow me to select the directory and overwrite the previous install.
> For what I know if it uses the same App ID (as I do) it should not allow
> the user to install twice, or at least warn them that they are going to
> be "repairing" the previous installation.

The default behaviour is to not ask for the directory (or group) on the
second or subsequent install, because it will overwrite the original
directory.

The other piece of the puzzle (which is also set by default) is that all
the files you install to {app} should have Flags: ignoreversion.

So this sounds like exactly what you want already.

Bill Stewart

unread,
Oct 20, 2022, 5:54:35 PM10/20/22
to innosetup
On Thursday, October 20, 2022 at 6:47:27 AM UTC-6 Federico Felman wrote:

The first time I run it everything is fine, the second one it should not allow me isntall it since it's already installed. Instead of that it doesn't allow me to select the directory and overwrite the previous install.
For what I know if it uses the same App ID (as I do) it should not allow the user to install twice, or at least warn them that they are going to be "repairing" the previous installation.

Not sure I understand the problem. Why prevent a reinstall?

Walter Dexter

unread,
Oct 26, 2022, 12:28:56 PM10/26/22
to innosetup
Seems like Federico wants Inno Setup to mimic Windows Installer (MSI engine) behavior. 

Bill Stewart

unread,
Oct 27, 2022, 5:21:49 PM10/27/22
to innosetup
On Wednesday, October 26, 2022 at 10:28:56 AM UTC-6 wfde...@gmail.com wrote:

Seems like Federico wants Inno Setup to mimic Windows Installer (MSI engine) behavior. 

This may be obvious but bears repeating: Inno Setup installers don't behave the same as MSI packages.

Stainless Games

unread,
Oct 28, 2022, 10:42:50 AM10/28/22
to innosetup
Hello everyone, thank you for the feedback. How can I avoid the installer trying to install the same app with the same version number twice? At least prompt the user "You already have this app. Press continue if you want to repair it". because I've been getting a lot of people running the installer over and over thinking it wasn't installed. Since it's a heavy build with a lot of post-install things I want to avoid that from happening unintentionally.

Jernej Simončič

unread,
Oct 28, 2022, 12:50:33 PM10/28/22
to 'Stainless Games' via innosetup on [innosetup]

On Friday, October 28, 2022, 16:42:50, 'Stainless Games' via innosetup wrote:


Hello everyone, thank you for the feedback. How can I avoid the installer trying to install the same app with the same version number twice? At least prompt the user "You already have this app. Press continue if you want to repair it". because I've been getting a lot of people running the installer over and over thinking it wasn't installed. Since it's a heavy build with a lot of post-install things I want to avoid that from happening unintentionally.

For a start, maybe make it more obvious that the program is installed (unfortunately, many users think the Setup failed if you follow Microsoft's recommendations, and don't put an icon on the desktop)?

 

Otherwise, use [Code] and put a check in InitializeSetup, something like this:

 

[Code]

 

const

    UninsKey = 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\AppId_is1'; 

 

function InitializeSetup(): Boolean; 

var Version: String;

begin

    Result := True; //allow install by default

 

    if RegQueryStringValue(HKLM, UninsKey, 'DisplayVersion', Version) then

        if Version = '{#MyAppVersion}' then 

            if SuppressibleMsgBox('{#MyAppName} {#MyAppVersion} is already installed. Do you want to reinstall?',mbConfirmation,MB_YESNO,IDYES) = IDNO then

                Result := False; 

 

end;

 

 

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


An original idea can never emerge from committee in the original.
       -- Boyle's Fifth Law

Gavin Lambert

unread,
Oct 30, 2022, 7:57:35 PM10/30/22
to inno...@googlegroups.com
On 29/10/2022 03:42, 'Stainless Games' wrote:
> Hello everyone, thank you for the feedback. How can I avoid the
> installer trying to install the same app with the same version number
> twice? At least prompt the user "You already have this app. Press
> continue if you want to repair it". because I've been getting a lot of
> people running the installer over and over thinking it wasn't installed.
> Since it's a heavy build with a lot of post-install things I want to
> avoid that from happening unintentionally.

The wizard generates a script that will by default run the application
at the end of the install, which avoids those sorts of issues -- if the
app starts up at the end, then the user knows it's obviously installed.
You can do the same in your own script.

This might occasionally still result in a user re-running the installer
to run the app again instead of using the installed shortcuts, but this
should be mostly harmless other than wasting a bit of the user's time
(and should be obvious if they actually read the screen at any point).
If it's *not* harmless (e.g. if it stomps on config files) then that's a
script bug that you should fix with the appropriate Flags.

There shouldn't really be any need to do anything beyond this.

Reply all
Reply to author
Forward
0 new messages