diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index 44332a237c..1fbb5987e4 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -102,13 +102,13 @@ jobs: - name: Install .NET uses: actions/setup-dotnet@v5 with: - dotnet-version: 8.0.x + global-json-file: global.json - name: Cache NuGet packages uses: actions/cache@v5 with: path: ${{ env.NUGET_PACKAGES }} - key: ${{ runner.os }}-nuget-${{ hashFiles('src/**/*.csproj', 'src/**/*.props', 'src/**/*.targets', 'src/**/*.sln') }} + key: ${{ runner.os }}-nuget-${{ hashFiles('global.json', 'src/**/*.csproj', 'src/**/*.props', 'src/**/*.targets', 'src/**/*.sln') }} restore-keys: | ${{ runner.os }}-nuget- @@ -184,11 +184,20 @@ jobs: shell: pwsh run: | $Platform = '${{ matrix.platform }}' + [xml]$BuildProps = Get-Content "src/Directory.Build.props" + $PortableTargetFramework = @($BuildProps.Project.PropertyGroup | Where-Object { $_.PortableTargetFramework } | Select-Object -First 1).PortableTargetFramework + $WindowsTargetPlatformVersion = @($BuildProps.Project.PropertyGroup | Where-Object { $_.WindowsTargetPlatformVersion } | Select-Object -First 1).WindowsTargetPlatformVersion + + if ([string]::IsNullOrWhiteSpace($PortableTargetFramework) -or [string]::IsNullOrWhiteSpace($WindowsTargetPlatformVersion)) { + throw "Could not resolve the target framework from src/Directory.Build.props" + } + + $TargetFramework = "$PortableTargetFramework-windows$WindowsTargetPlatformVersion" dotnet publish src/UniGetUI/UniGetUI.csproj /noLogo /p:Configuration=Release /p:Platform=$Platform -p:RuntimeIdentifier=win-$Platform -v m if ($LASTEXITCODE -ne 0) { throw "dotnet publish failed" } # Stage binaries - $PublishDir = "src/UniGetUI/bin/$Platform/Release/net8.0-windows10.0.26100.0/win-$Platform/publish" + $PublishDir = "src/UniGetUI/bin/$Platform/Release/$TargetFramework/win-$Platform/publish" if (Test-Path "unigetui_bin") { Remove-Item "unigetui_bin" -Recurse -Force } New-Item "unigetui_bin" -ItemType Directory | Out-Null Get-ChildItem $PublishDir | Move-Item -Destination "unigetui_bin" -Force @@ -233,16 +242,19 @@ jobs: # Build the installer (signing of the installer itself happens in the next step) # Temporarily remove SignTool line so ISCC doesn't try to sign during build $issContent = Get-Content $IssPath -Raw - $issContentNoSign = $issContent -Replace '(?m)^SignTool=.*$', '; SignTool=azsign (disabled for CI, signed separately)' - $issContentNoSign = $issContentNoSign -Replace '(?m)^SignedUninstaller=yes', 'SignedUninstaller=no' - Set-Content $IssPath $issContentNoSign -NoNewline - $InstallerBaseName = "UniGetUI.Installer.$Platform" - & ISCC.exe $IssPath /F"$InstallerBaseName" /O"$OutputDir" - if ($LASTEXITCODE -ne 0) { throw "Inno Setup failed with exit code $LASTEXITCODE" } + try { + $issContentNoSign = $issContent -Replace '(?m)^SignTool=.*$', '; SignTool=azsign (disabled for CI, signed separately)' + $issContentNoSign = $issContentNoSign -Replace '(?m)^SignedUninstaller=yes', 'SignedUninstaller=no' + Set-Content $IssPath $issContentNoSign -NoNewline - # Restore original ISS content - Set-Content $IssPath $issContent -NoNewline + $InstallerBaseName = "UniGetUI.Installer.$Platform" + & ISCC.exe $IssPath /F"$InstallerBaseName" /O"$OutputDir" + if ($LASTEXITCODE -ne 0) { throw "Inno Setup failed with exit code $LASTEXITCODE" } + } + finally { + Set-Content $IssPath $issContent -NoNewline + } - name: Stage output shell: pwsh diff --git a/.github/workflows/dotnet-test.yml b/.github/workflows/dotnet-test.yml index 168de77905..1d6236930a 100644 --- a/.github/workflows/dotnet-test.yml +++ b/.github/workflows/dotnet-test.yml @@ -3,6 +3,7 @@ on: push: branches: [ "main" ] paths: + - 'global.json' - '**.cs' - '**.csproj' - '**.props' @@ -14,6 +15,7 @@ on: pull_request: branches: [ "main" ] paths: + - 'global.json' - '**.cs' - '**.csproj' - '**.props' @@ -36,16 +38,16 @@ jobs: with: fetch-depth: 0 - - name: Install .NET Core + - name: Install .NET SDK uses: actions/setup-dotnet@v5 with: - dotnet-version: 8.0.x + global-json-file: global.json - name: Cache NuGet packages uses: actions/cache@v5 with: path: ${{ env.NUGET_PACKAGES }} - key: ${{ runner.os }}-nuget-${{ hashFiles('src/**/*.csproj', 'src/**/*.props', 'src/**/*.targets', 'src/**/*.sln') }} + key: ${{ runner.os }}-nuget-${{ hashFiles('global.json', 'src/**/*.csproj', 'src/**/*.props', 'src/**/*.targets', 'src/**/*.sln') }} restore-keys: | ${{ runner.os }}-nuget- diff --git a/.gitignore b/.gitignore index d3e9f6a3f4..7f0e5891dc 100644 --- a/.gitignore +++ b/.gitignore @@ -86,7 +86,6 @@ src/UniGetUI/choco-cli/extensions/chocolatey-dotnetfx/ InstallerExtras/MsiCreator/setup.exe InstallerExtras/MsiCreator/UniGetUI Installer.msi InstallerExtras/MsiCreator/UniGetUISetup.msi -src/global.json UniGetUI.Installer.ms-store-test.exe UniGetUI Installer_winget-fix-test.exe InstallerExtras/uninst-*.e32 diff --git a/AGENTS.md b/AGENTS.md index f72a2c4e01..7ef1566e8b 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -2,7 +2,7 @@ ## Project Overview -UniGetUI is a WinUI 3 desktop app (C#/.NET 8, Windows App SDK) providing a GUI for CLI package managers (WinGet, Scoop, Chocolatey, Pip, Npm, .NET Tool, PowerShell Gallery, Cargo, Vcpkg). Solution lives in `src/UniGetUI.sln`. +UniGetUI is a WinUI 3 desktop app (C#/.NET 10, Windows App SDK) providing a GUI for CLI package managers (WinGet, Scoop, Chocolatey, Pip, Npm, .NET Tool, PowerShell Gallery, Cargo, Vcpkg). Solution lives in `src/UniGetUI.sln`. ## Architecture @@ -44,7 +44,7 @@ dotnet test --verbosity q --nologo dotnet publish src/UniGetUI/UniGetUI.csproj /p:Configuration=Release /p:Platform=x64 ``` -- Target framework: `net8.0-windows10.0.26100.0` (min `10.0.19041`) +- Target framework: `net10.0-windows10.0.26100.0` (min `10.0.19041`) - Build generates secrets via `src/UniGetUI/Services/generate-secrets.ps1` and integrity tree via `scripts/generate-integrity-tree.ps1` - Self-contained, publish-trimmed (partial), Windows App SDK self-contained - Tests use **xUnit** (`[Fact]`, `Assert.*`) diff --git a/UniGetUI.iss b/UniGetUI.iss index 9ba6d22a09..7cc848992a 100644 --- a/UniGetUI.iss +++ b/UniGetUI.iss @@ -1,4 +1,4 @@ -; Script generated by the Inno Setup Script Wizard. +; Script generated by the Inno Setup Script Wizard. ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! #define MyAppVersion "3.3.7" @@ -30,8 +30,8 @@ DisableProgramGroupPage=yes DisableDirPage=no DirExistsWarning=no CloseApplications=no -; Remove the following line to run in administrative install mode (install for all users.) -;PrivilegesRequired=lowest +; Default to per-user install mode and let the dialog opt into all-users installs when needed. +PrivilegesRequired=lowest PrivilegesRequiredOverridesAllowed=dialog OutputBaseFilename=UniGetUI Installer OutputDir=. diff --git a/configuration.winget/develop-unigetui.winget b/configuration.winget/develop-unigetui.winget index 051f50cc31..84aa8dbdf6 100644 --- a/configuration.winget/develop-unigetui.winget +++ b/configuration.winget/develop-unigetui.winget @@ -63,10 +63,10 @@ resources: id: Microsoft.VisualStudio.2022.Community source: winget -- name: Install .NET 8 SDK +- name: Install .NET 10 SDK type: Microsoft.WinGet/Package properties: - id: Microsoft.DotNet.SDK.8 + id: Microsoft.DotNet.SDK.10 source: winget - name: Install Windows App SDK diff --git a/configuration.winget/unigetui-all.winget b/configuration.winget/unigetui-all.winget index 127129bb7d..f8f9e7c184 100644 --- a/configuration.winget/unigetui-all.winget +++ b/configuration.winget/unigetui-all.winget @@ -56,10 +56,10 @@ resources: id: Rustlang.Rustup source: winget -- name: Install .NET 8 SDK +- name: Install .NET 10 SDK type: Microsoft.WinGet/Package properties: - id: Microsoft.DotNet.SDK.8 + id: Microsoft.DotNet.SDK.10 source: winget # vcpkg bootstrap is optional; run scripts\dev-setup-optional.ps1 if needed. diff --git a/global.json b/global.json new file mode 100644 index 0000000000..58bcbf1f69 --- /dev/null +++ b/global.json @@ -0,0 +1,6 @@ +{ + "sdk": { + "version": "10.0.103", + "rollForward": "latestPatch" + } +} \ No newline at end of file diff --git a/scripts/build.ps1 b/scripts/build.ps1 index a81c080053..1102d9915f 100644 --- a/scripts/build.ps1 +++ b/scripts/build.ps1 @@ -39,7 +39,16 @@ $RepoRoot = Resolve-Path (Join-Path $PSScriptRoot "..") $SrcDir = Join-Path $RepoRoot "src" $PublishProject = Join-Path $SrcDir "UniGetUI" "UniGetUI.csproj" $BinDir = Join-Path $RepoRoot "unigetui_bin" -$TargetFramework = "net8.0-windows10.0.26100.0" +$BuildPropsPath = Join-Path $SrcDir "Directory.Build.props" +[xml] $BuildProps = Get-Content $BuildPropsPath +$PortableTargetFramework = @($BuildProps.Project.PropertyGroup | Where-Object { $_.PortableTargetFramework } | Select-Object -First 1).PortableTargetFramework +$WindowsTargetPlatformVersion = @($BuildProps.Project.PropertyGroup | Where-Object { $_.WindowsTargetPlatformVersion } | Select-Object -First 1).WindowsTargetPlatformVersion + +if ([string]::IsNullOrWhiteSpace($PortableTargetFramework) -or [string]::IsNullOrWhiteSpace($WindowsTargetPlatformVersion)) { + throw "Could not resolve the target framework from $BuildPropsPath" +} + +$TargetFramework = "$PortableTargetFramework-windows$WindowsTargetPlatformVersion" $PublishDir = Join-Path $SrcDir "UniGetUI" "bin" $Platform $Configuration $TargetFramework "win-$Platform" "publish" # --- Version stamping --- @@ -57,7 +66,7 @@ Write-Host "Building UniGetUI version: $PackageVersion" # --- Test --- if (-not $SkipTests) { Write-Host "`n=== Running tests ===" -ForegroundColor Cyan - dotnet test (Join-Path $SrcDir "UniGetUI.sln") --verbosity q --nologo + dotnet test (Join-Path $SrcDir "UniGetUI.sln") --verbosity q --nologo --ignore-failed-sources if ($LASTEXITCODE -ne 0) { throw "Tests failed with exit code $LASTEXITCODE" } @@ -71,7 +80,7 @@ dotnet clean (Join-Path $SrcDir "UniGetUI.sln") -v m --nologo Write-Host "`n=== Fetching winget-cli ($Platform) ===" -ForegroundColor Cyan & (Join-Path $PSScriptRoot "fetch-winget-cli.ps1") -Architectures @($Platform) -Force -dotnet publish $PublishProject /noLogo /p:Configuration=$Configuration /p:Platform=$Platform -v m +dotnet publish $PublishProject /noLogo /p:Configuration=$Configuration /p:Platform=$Platform --ignore-failed-sources -v m if ($LASTEXITCODE -ne 0) { throw "dotnet publish failed with exit code $LASTEXITCODE" } @@ -112,9 +121,21 @@ if (-not $SkipInstaller) { if ($IsccPath) { Write-Host "`n=== Building installer ===" -ForegroundColor Cyan $InstallerBaseName = "UniGetUI.Installer.$Platform" - & $IsccPath (Join-Path $RepoRoot "UniGetUI.iss") /F"$InstallerBaseName" /O"$OutputPath" - if ($LASTEXITCODE -ne 0) { - throw "Inno Setup failed with exit code $LASTEXITCODE" + $IssPath = Join-Path $RepoRoot "UniGetUI.iss" + $IssContent = Get-Content $IssPath -Raw + + try { + $IssContentNoSign = $IssContent -Replace '(?m)^SignTool=.*$', '; SignTool=azsign (disabled for local build)' + $IssContentNoSign = $IssContentNoSign -Replace '(?m)^SignedUninstaller=yes', 'SignedUninstaller=no' + Set-Content $IssPath $IssContentNoSign -NoNewline + + & $IsccPath $IssPath /F"$InstallerBaseName" /O"$OutputPath" + if ($LASTEXITCODE -ne 0) { + throw "Inno Setup failed with exit code $LASTEXITCODE" + } + } + finally { + Set-Content $IssPath $IssContent -NoNewline } } else { Write-Warning "Inno Setup 6 (ISCC.exe) not found — skipping installer build." diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 42c53f52c4..16c151d749 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -4,14 +4,14 @@ - 8.0.407 + 10.0.103 Devolutions Inc. and the contributors Devolutions Inc. enable - net8.0 + net10.0 10.0.26100.0 $(PortableTargetFramework)-windows$(WindowsTargetPlatformVersion) diff --git a/src/UniGetUI.Interface.BackgroundApi/UniGetUI.Interface.BackgroundApi.csproj b/src/UniGetUI.Interface.BackgroundApi/UniGetUI.Interface.BackgroundApi.csproj index 0742cb6ac3..a2690ce025 100644 --- a/src/UniGetUI.Interface.BackgroundApi/UniGetUI.Interface.BackgroundApi.csproj +++ b/src/UniGetUI.Interface.BackgroundApi/UniGetUI.Interface.BackgroundApi.csproj @@ -6,9 +6,6 @@ - - - diff --git a/src/UniGetUI.Interface.Telemetry/UniGetUI.Interface.Telemetry.csproj b/src/UniGetUI.Interface.Telemetry/UniGetUI.Interface.Telemetry.csproj index 79676932b2..241d5bc749 100644 --- a/src/UniGetUI.Interface.Telemetry/UniGetUI.Interface.Telemetry.csproj +++ b/src/UniGetUI.Interface.Telemetry/UniGetUI.Interface.Telemetry.csproj @@ -15,9 +15,6 @@ - - - diff --git a/src/UniGetUI/.vscode/launch.json b/src/UniGetUI/.vscode/launch.json index 5d6ee6f56c..53a6648256 100644 --- a/src/UniGetUI/.vscode/launch.json +++ b/src/UniGetUI/.vscode/launch.json @@ -1,15 +1,15 @@ { "configurations": [ - { - "name": "WingetUI (Unpackaged)", - "type": "coreclr", - "request": "launch", - "preLaunchTask": "dotnet: build y:\\WingetUI-Store\\src\\wingetui-interface\\wingetui-interface.csproj", - "program": "${workspaceFolder}/bin/Debug/net6.0-windows10.0.19041.0/wingetui-interface.exe", - "args": [], - "cwd": "${workspaceFolder}/bin/Debug/net6.0-windows10.0.19041.0/", - "console": "integratedTerminal", - "stopAtEntry": false - }, + { + "name": "UniGetUI (Unpackaged)", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "build UniGetUI (Debug x64)", + "program": "${workspaceFolder}/bin/x64/Debug/net10.0-windows10.0.26100.0/UniGetUI.exe", + "args": [], + "cwd": "${workspaceFolder}/bin/x64/Debug/net10.0-windows10.0.26100.0/", + "console": "integratedTerminal", + "stopAtEntry": false + } ] } \ No newline at end of file diff --git a/src/UniGetUI/.vscode/tasks.json b/src/UniGetUI/.vscode/tasks.json index b36325d3f0..a8075f1791 100644 --- a/src/UniGetUI/.vscode/tasks.json +++ b/src/UniGetUI/.vscode/tasks.json @@ -1,15 +1,22 @@ { + "version": "2.0.0", "tasks": [ { - "type": "dotnet", - "task": "build y:\\WingetUI-Store\\src\\wingetui-interface\\wingetui-interface.csproj --debug", - "file": "y:\\WingetUI-Store\\src\\wingetui-interface\\wingetui-interface.csproj", + "label": "build UniGetUI (Debug x64)", + "type": "process", + "command": "dotnet", + "args": [ + "build", + "${workspaceFolder}/UniGetUI.csproj", + "--configuration", + "Debug", + "/p:Platform=x64" + ], "group": { "kind": "build", "isDefault": true }, - "problemMatcher": [], - "label": "dotnet: build y:\\WingetUI-Store\\src\\wingetui-interface\\wingetui-interface.csproj" + "problemMatcher": "$msCompile" } ] } \ No newline at end of file diff --git a/src/UniGetUI/AutoUpdater.cs b/src/UniGetUI/AutoUpdater.cs index 59b4851db5..7c5f4e4632 100644 --- a/src/UniGetUI/AutoUpdater.cs +++ b/src/UniGetUI/AutoUpdater.cs @@ -432,9 +432,11 @@ UpdaterOverrides updaterOverrides try { +#pragma warning disable SYSLIB0057 X509Certificate signerCertificate = X509Certificate.CreateFromSignedFile( installerLocation ); +#pragma warning restore SYSLIB0057 using X509Certificate2 cert = new(signerCertificate); string signerThumbprint = NormalizeThumbprint(cert.Thumbprint ?? string.Empty); diff --git a/src/UniGetUI/UniGetUI.csproj b/src/UniGetUI/UniGetUI.csproj index 3b67cbbfdd..70f5890de8 100644 --- a/src/UniGetUI/UniGetUI.csproj +++ b/src/UniGetUI/UniGetUI.csproj @@ -133,9 +133,6 @@ - - -