#ifndef AppVersion #error AppVersion is required #endif [Setup] AppId={{68CC5D47-729F-4E7B-875F-BA091EC0BF9D} AppName=TTSTDConnect AppVersion={#AppVersion} AppPublisher=TTSTD DefaultDirName={localappdata}\Programs\TTSTDConnect DefaultGroupName=TTSTDConnect PrivilegesRequired=lowest MinVersion=10.0 ArchitecturesAllowed=x64compatible ArchitecturesInstallIn64BitMode=x64compatible OutputDir={#OutputDir} OutputBaseFilename=TTSTDConnect-{#AppVersion}-windows-x64-setup SetupIconFile=..\..\flutter_sender\windows\runner\resources\app_icon.ico UninstallDisplayIcon={app}\ttstd_sender.exe Compression=lzma2 SolidCompression=yes WizardStyle=modern CloseApplications=yes RestartApplications=no [Tasks] Name: desktopicon; Description: "Create a desktop shortcut"; Flags: unchecked [Files] Source: "stop-installed-processes.ps1"; Flags: dontcopy Source: "{#VCRedist}"; DestDir: "{tmp}"; DestName: "vc_redist.x64.exe"; Flags: deleteafterinstall Source: "{#BundleDir}\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs [Icons] Name: "{group}\TTSTDConnect"; Filename: "{app}\ttstd_sender.exe" Name: "{autodesktop}\TTSTDConnect"; Filename: "{app}\ttstd_sender.exe"; Tasks: desktopicon [Run] Filename: "{tmp}\vc_redist.x64.exe"; Parameters: "/install /passive /norestart"; StatusMsg: "Installing Microsoft Visual C++ Runtime"; Flags: waituntilterminated Filename: "{app}\ttstd_sender.exe"; Description: "Launch TTSTDConnect"; Flags: nowait postinstall skipifsilent [Code] function PrepareToInstall(var NeedsRestart: Boolean): String; var ExitCode: Integer; begin Result := ''; ExtractTemporaryFile('stop-installed-processes.ps1'); if not Exec(ExpandConstant('{sys}\WindowsPowerShell\v1.0\powershell.exe'), '-NoProfile -NonInteractive -ExecutionPolicy Bypass -File "' + ExpandConstant('{tmp}\stop-installed-processes.ps1') + '" -InstallDir "' + ExpandConstant('{app}') + '"', '', SW_HIDE, ewWaitUntilTerminated, ExitCode) then Result := 'Unable to stop the installed application and signaling server.'; if (Result = '') and (ExitCode <> 0) then Result := 'The installed application or signaling server could not be stopped. Close it and retry.'; end;