Toby
Toby

Reputation: 390

Inno setup executes [UninstallRun] during installation followup

This question:

Inno setup executes [UninstallRun] during installation

E.g. Code:

[UninstallRun]
Filename: "{sys}\OfflineSvc.exe"; Parameters: "-uninstall"; WorkingDir: "{sys}"; Flags: skipifdoesntexist 32bit; StatusMsg: "Offline Processing service is being uninstalled. Please wait..."; BeforeInstall: SimpleStopService('Offline_Service', True, False); Flags: waituntilterminated

doesn't have a clear solution. It SEEMS to indicate the cause but provides no obvious solution (maybe I'm just dense).

Why does an UNINSTALLRUN item run during INSTALLATION?

If that is normal - how can you prevent it?

The INNO help says:

The [UninstallRun] section is optional as well, and specifies any number of programs to execute as the first step of uninstallation.

So one would expect that the UNINSTALLRUN section would only be executed when UnInstalling.

Sorry - I am new to posting on SO and it won't let me comment on the above question so I don't see any alternative to get more info except for posting a new question. If there is a better way for newbies please let me know how I SHOULD have done it.

Upvotes: 2

Views: 4197

Answers (1)

Robert Wigley
Robert Wigley

Reputation: 1957

The [UninstallRun] section does not actually run during the installation, but writes into the uninstaller log that is created during installation. You simply specify the [UninstallRun] section in the Setup script so that you can tell the uninstaller what to do in addition to removing whatever was installed e.g. you could use it to stop and remove a Service that you installed using sc.exe in the [Run] section during the installation.

In the referenced example, it is evaluating the {code} function to determine the hardcoded filename to add to the uninstaller log, as I believe the uninstaller cannot have a code query in to be evaluated at uninstall, only a hardcoded filename and path which is stored in the uninstall log.

Upvotes: 2

Related Questions