|
| 1 | +#define MyAppName "Emulator for Azure App Configuration" |
| 2 | +#define MyAppVersion "1.0.0" |
| 3 | +#define MyAppPublisher "Thomas Clark" |
| 4 | +#define MyAppURL "https://azureappconfigurationemulator.thomasclark.app" |
| 5 | +#define MyAppExeName "AzureAppConfigurationEmulator.exe" |
| 6 | + |
| 7 | +[Setup] |
| 8 | +AppId={{7D09D62B-09DF-4C36-8736-96FE3BEE4830} |
| 9 | +AppName={#MyAppName} |
| 10 | +AppPublisher={#MyAppPublisher} |
| 11 | +AppPublisherURL={#MyAppURL} |
| 12 | +AppSupportURL={#MyAppURL} |
| 13 | +AppUpdatesURL={#MyAppURL} |
| 14 | +AppVersion={#MyAppVersion} |
| 15 | +#if Architecture == "arm64" |
| 16 | + ArchitecturesAllowed=arm64 |
| 17 | +#elif Architecture == "x64" |
| 18 | + ArchitecturesAllowed=x64 |
| 19 | +#endif |
| 20 | +ArchitecturesInstallIn64BitMode=arm64 x64 |
| 21 | +DefaultDirName={autopf}\{#MyAppName} |
| 22 | +LicenseFile=LICENSE |
| 23 | +PrivilegesRequiredOverridesAllowed=dialog |
| 24 | +SolidCompression=yes |
| 25 | +WizardStyle=modern |
| 26 | + |
| 27 | +[Languages] |
| 28 | +Name: "english"; MessagesFile: "compiler:Default.isl" |
| 29 | + |
| 30 | +[Tasks] |
| 31 | +Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked |
| 32 | + |
| 33 | +[Files] |
| 34 | +Source: "src\AzureAppConfigurationEmulator\bin\Release\net8.0\win-{#Architecture}\publish\*"; DestDir: "{app}"; Flags: createallsubdirs ignoreversion recursesubdirs |
| 35 | + |
| 36 | +[Icons] |
| 37 | +Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}" |
| 38 | +Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon |
| 39 | + |
| 40 | +[Run] |
| 41 | +Filename: "{tmp}\aspnetcore-runtime.exe"; Parameters: "/install /quiet /norestart"; Check: AspNetCoreRuntimeNeedsInstall |
| 42 | +Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent |
| 43 | + |
| 44 | +[Code] |
| 45 | +var |
| 46 | + DownloadPage: TDownloadWizardPage; |
| 47 | +function AspNetCoreRuntimeNeedsInstall: Boolean; |
| 48 | +var |
| 49 | + FileName: String; |
| 50 | + Output: AnsiString; |
| 51 | + ResultCode: Integer; |
| 52 | +begin |
| 53 | + Result := True; |
| 54 | + FileName := ExpandConstant('{tmp}\dotnet.txt'); |
| 55 | + if Exec(ExpandConstant('{cmd}'), '/C dotnet --list-runtimes > "' + FileName + '" 2>&1', '', SW_HIDE, ewWaitUntilTerminated, ResultCode) and (ResultCode = 0) then |
| 56 | + if LoadStringFromFile(FileName, Output) then |
| 57 | + if Pos('Microsoft.AspNetCore.App 8.0', Output) > 0 then |
| 58 | + Result := False; |
| 59 | +end; |
| 60 | +procedure InitializeWizard; |
| 61 | +begin |
| 62 | + DownloadPage := CreateDownloadPage(SetupMessage(msgWizardPreparing), SetupMessage(msgPreparingDesc), nil); |
| 63 | +end; |
| 64 | +function NextButtonClick(CurPageID: Integer): Boolean; |
| 65 | +begin |
| 66 | + if CurPageID = wpReady then |
| 67 | + begin |
| 68 | + DownloadPage.Clear; |
| 69 | + #if Architecture == "arm64" |
| 70 | + DownloadPage.Add('https://download.visualstudio.microsoft.com/download/pr/ee1b10d3-aca1-4ae0-b74a-97bd30fa6d2d/87e7a62e9f5438342b66e673d422cd57/aspnetcore-runtime-8.0.6-win-arm64.exe', 'aspnetcore-runtime.exe', ''); |
| 71 | + #elif Architecture == "x64" |
| 72 | + DownloadPage.Add('https://download.visualstudio.microsoft.com/download/pr/38b32fc8-8070-4f14-bd52-65505fddc5ff/50e6cf3b7505eee02c3b3db8ea46ffe3/aspnetcore-runtime-8.0.6-win-x64.exe', 'aspnetcore-runtime.exe', ''); |
| 73 | + #endif |
| 74 | + DownloadPage.Show; |
| 75 | + try |
| 76 | + try |
| 77 | + DownloadPage.Download; |
| 78 | + Result := True; |
| 79 | + except |
| 80 | + if not DownloadPage.AbortedByUser then |
| 81 | + SuppressibleMsgBox(AddPeriod(GetExceptionMessage), mbCriticalError, MB_OK, IDOK); |
| 82 | + Result := False; |
| 83 | + end; |
| 84 | + finally |
| 85 | + DownloadPage.Hide; |
| 86 | + end; |
| 87 | + end else |
| 88 | + Result := True; |
| 89 | +end; |
0 commit comments