diff --git a/.github/workflows/GenerateRelease-csharp.yml b/.github/workflows/GenerateRelease-csharp.yml index 3e2798bad..7d74b3959 100644 --- a/.github/workflows/GenerateRelease-csharp.yml +++ b/.github/workflows/GenerateRelease-csharp.yml @@ -24,7 +24,6 @@ jobs: - uses: actions/checkout@v4 with: ref: '${{ github.ref }}' - fetch-depth: 0 - uses: actions/setup-dotnet@main with: @@ -40,10 +39,7 @@ jobs: run: foreach($file in $((dir "publish" | where {$_.extension -in ".exe"}).Fullname)){ mv "$file" "STAGING" } - name: Prepare Installer Prerequisites - id: InitInstaller - run: | - echo AppVersion="$(git describe --tags --abbrev=0)" >> "$GITHUB_OUTPUT" - git clone https://github.com/DomGries/InnoDependencyInstaller + run: git clone https://github.com/DomGries/InnoDependencyInstaller - name: Build VolumeControl Binary (Installer Version) run: dotnet publish VolumeControl -c Release-ForInstaller -p:PublishProfile="VolumeControl/Properties/PublishProfiles/PublishForInstaller.pubxml" @@ -52,7 +48,7 @@ jobs: uses: Minionguyjpro/Inno-Setup-Action@v1.1.0 with: path: vcsetup.iss - options: /dAppVersion="${{ steps.InitInstaller.outputs.AppVersion }}" /Opublish + options: /Opublish - name: Stage Installer run: foreach($file in $((dir "publish" | where {$_.extension -in ".exe"}).Fullname)){ mv "$file" "STAGING" } diff --git a/vcsetup.iss b/vcsetup.iss index c5727d61d..c5910d28f 100644 --- a/vcsetup.iss +++ b/vcsetup.iss @@ -3,7 +3,9 @@ ; - AppVersion must be defined on the commandline with /dAppVersion="" #define public Dependency_Path_NetCoreCheck "InnoDependencyInstaller\dependencies\" -#include "InnoDependencyInstaller\CodeDependencies.iss" +#include "InnoDependencyInstaller\CodeDependencies.iss" + +#define SourceExeFilePath "publish\installer" #define AppID "{33DFCEE8-022C-4C66-A366-79A7415320F2}" #define AppName "Volume Control" @@ -13,8 +15,8 @@ #define AppURL "https://github.com/radj307/volume-control" #define AppExeName "VolumeControl.exe" #define AppMutex "VolumeControlSingleInstance" - -#define SourceExeFilePath "publish\installer" +#define AppFileVersion GetStringFileInfo(SourceExeFilePath + "\" + AppExeName, "FileVersion") +#define AppVersion GetStringFileInfo(SourceExeFilePath + "\" + AppExeName, "ProductVersion") [Setup] AppId={{#AppID} @@ -29,6 +31,7 @@ AppUpdatesURL={#AppURL} VersionInfoDescription={#AppName} installer VersionInfoProductName={#AppName} +VersionInfoVersion={#AppFileVersion} UninstallDisplayIcon={app}\{#AppExeName} UninstallDisplayName={#AppName} @@ -79,19 +82,18 @@ Filename: "{app}\{#AppExeName}"; Description: "{cm:LaunchProgram,{#StringChange( [UninstallDelete] Type: dirifempty; Name: "{app}" -[Registry] -; All Users -Root: HKLM; Subkey: "Software\Microsoft\Windows\CurrentVersion\Uninstall\{{#AppID}_is1"; ValueType: string; ValueName: "DisplayVersion"; ValueData: "{#AppVersion}"; Flags: uninsdeletevalue; Check: IsAdmin -; Current User -Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Uninstall\{{#AppID}_is1"; ValueType: string; ValueName: "DisplayVersion"; ValueData: "{#AppVersion}"; Flags: uninsdeletevalue; Check: not IsAdmin - [Code] +function GetUninstallKey(): String; +begin + Result := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\{#emit SetupSetting("AppId")}_is1'); +end; + function GetUninstallString(): String; var sUnInstPath: String; sUnInstallString: String; begin - sUnInstPath := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\{#emit SetupSetting("AppId")}_is1'); + sUnInstPath := GetUninstallKey(); sUnInstallString := ''; if not RegQueryStringValue(HKLM, sUnInstPath, 'UninstallString', sUnInstallString) then RegQueryStringValue(HKCU, sUnInstPath, 'UninstallString', sUnInstallString); @@ -136,6 +138,8 @@ begin begin UnInstallOldVersion(); end; + end else if (CurStep=ssPostInstall) then begin + RegWriteStringValue(HKEY_AUTO, GetUninstallKey(), 'DisplayVersion', '{#emit SetupSetting('AppVersion')}'); end; end;