Reputation: 987
I have an Inno Setup v5.5.9 file shown below;
[Languages]
Name: english; MessagesFile: compiler:Default.isl
[Files]
Source: "Setups\SQLEXPR_x64_ENU.exe"; DestDir: {tmp}\Setups; Flags: nocompression;
[UninstallRun]
Filename: {tmp}\Setups\SQLEXPR_x64_ENU.exe; Parameters: "/QS /ACTION=unInstall /FEATURES=SQLENGINE /INSTANCENAME=CASSQL";
[Run]
Filename: {tmp}\Setups\SQLEXPR_x64_ENU.exe; Parameters: "/QS /ACTION=Install /FEATURES=SQLENGINE /INSTANCENAME=CASSQL /INSTANCEDIR=""{pf}\Microsoft SQL Server\MSSQL14.CASSQL"" /SQLSVCACCOUNT=""NT Authority\Network Service"" /TCPENABLED=1 /SECURITYMODE=SQL /ADDCURRENTUSERASSQLADMIN /SAPWD=sapassword /IACCEPTSQLSERVERLICENSETERMS";
The install works just fine, but once installed, if I go to Control Panel and right-click on the installer and select Uninstall, the uninstall will remove the installer from control panel but it doesn't actually run the SQLEXPR_x64_ENU.exe or uninstall the SQL Server Express named instance.
I read that Inno Setup would automatically handle uninstall, so I removed the [UninstallRun] section, but had the same result.
I can run the following :
SQLEXPR_x64_ENU.exe /QS /ACTION=unInstall /FEATURES=SQLENGINE /INSTANCENAME=CASSQL
From the command line and it works as expected.
[UPDATE #1 7/23/19] I added SetupLogging=yes to the [Setup] section, hoping to see something useful in a log file. Inno Setup created the log file when I ran the install, but did not create any log file when I ran the Uninstall by right-clicking on the Inno Setup generated installer in Control Panel.
What am I missing here?
Upvotes: 0
Views: 261
Reputation: 202393
The files installed to {tmp}
exist only for a duration of the installation:
Temporary directory used by Setup or Uninstall. This is not the value of the user's TEMP environment variable. It is a subdirectory of the user's temporary directory which is created by Setup or Uninstall at startup (with a name like "C:\WINDOWS\TEMP\IS-xxxxx.tmp"). All files and subdirectories in this directory are deleted when Setup or Uninstall exits. During Setup, this is primarily useful for extracting files that are to be executed in the [Run] section but aren't needed after the installation.
So at the time you run the uninstaller, the {tmp}\Setups\SQLEXPR_x64_ENU.exe
does not exist anymore.
If you run the uninstaller manually from command-line and add /log=C:\some\path\uninstall.log
switch, you wil find something like this in the log:
2019-07-24 08:46:04.614 Running Exec filename: C:\Users\marti\AppData\Local\Temp\is-K316U.tmp\Setups\SQLEXPR_x64_ENU.exe
2019-07-24 08:46:04.614 Running Exec parameters: /QS /ACTION=unInstall /FEATURES=SQLENGINE /INSTANCENAME=CASSQL
2019-07-24 08:46:04.615 CreateProcess failed (2).
If you want to be able to run SQLEXPR_x64_ENU.exe
during uninstallation, you have to deploy it to a different folder, like to {app}
.
You can can also embed the file into the uninstaller itself, if it is not too large (what it possibly is):
How keep uninstall files inside uninstaller?
Upvotes: 1