From cd5a6f1162e4be419b6bb6a941b89b2ec4f0ca1d Mon Sep 17 00:00:00 2001 From: Michael Suchacz <203725896+ibetitsmike@users.noreply.github.com> Date: Tue, 23 Sep 2025 09:25:59 +0200 Subject: [PATCH 1/2] fix: add self contained app sdk --- App/App.csproj | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/App/App.csproj b/App/App.csproj index 5d60658..9a91849 100644 --- a/App/App.csproj +++ b/App/App.csproj @@ -1,4 +1,4 @@ - + WinExe net8.0-windows10.0.19041.0 @@ -27,6 +27,7 @@ © Coder Technologies Inc. coder.ico false + true From 2784368ed70bc09e76b2485886b40fc3b393b0c3 Mon Sep 17 00:00:00 2001 From: Michael Suchacz <203725896+ibetitsmike@users.noreply.github.com> Date: Tue, 23 Sep 2025 10:48:42 +0200 Subject: [PATCH 2/2] fix in the app output build path; removed the app sdk from installer --- .github/workflows/ci.yaml | 12 ------------ Installer/Program.cs | 27 --------------------------- scripts/Get-WindowsAppSdk.ps1 | 35 ----------------------------------- scripts/Publish.ps1 | 7 +------ 4 files changed, 1 insertion(+), 80 deletions(-) delete mode 100644 scripts/Get-WindowsAppSdk.ps1 diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 3ae4709..a21166a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -36,18 +36,6 @@ jobs: dotnet-version: 8.0.x cache: true cache-dependency-path: '**/packages.lock.json' - - name: Install Windows App SDK Runtime - shell: pwsh - run: | - $ErrorActionPreference = "Stop" - - $filename = ".\WindowsAppRuntimeInstall-x64.exe" - $url = "https://aka.ms/windowsappsdk/1.8/1.8.250907003/windowsappruntimeinstall-x64.exe" # 1.8.0 (1.8.250907003) - & curl.exe --progress-bar --show-error --fail --location --output $filename $url - if ($LASTEXITCODE -ne 0) { throw "Failed to download Windows App SDK" } - - $process = Start-Process -FilePath $filename -ArgumentList "--quiet --force" -NoNewWindow -Wait -PassThru - if ($process.ExitCode -ne 0) { throw "Failed to install Windows App SDK: exit code is $($process.ExitCode)" } - name: dotnet restore run: dotnet restore --locked-mode - name: dotnet test diff --git a/Installer/Program.cs b/Installer/Program.cs index 3d300ed..98ed6fa 100644 --- a/Installer/Program.cs +++ b/Installer/Program.cs @@ -116,9 +116,6 @@ public class BootstrapperOptions : SharedOptions [Option('m', "msi-path", Required = true, HelpText = "Path to the MSI package to embed")] public string MsiPath { get; set; } - [Option('w', "windows-app-sdk-path", Required = true, HelpText = "Path to the Windows App Sdk package to embed")] - public string WindowsAppSdkPath { get; set; } - [Option('t', "theme-xml-path", Required = false, HelpText = "Path to the theme .xml file to use for the installer")] public string ThemeXmlPath { get; set; } @@ -130,9 +127,6 @@ public class BootstrapperOptions : SharedOptions throw new ArgumentException($"Logo PNG file not found at '{LogoPng}'", nameof(LogoPng)); if (!SystemFile.Exists(MsiPath)) throw new ArgumentException($"MSI package not found at '{MsiPath}'", nameof(MsiPath)); - if (!SystemFile.Exists(WindowsAppSdkPath)) - throw new ArgumentException($"Windows App Sdk package not found at '{WindowsAppSdkPath}'", - nameof(WindowsAppSdkPath)); if (ThemeXmlPath != null && !SystemFile.Exists(ThemeXmlPath)) throw new ArgumentException($"Theme XML file not found at '{ThemeXmlPath}'", nameof(ThemeXmlPath)); } @@ -374,27 +368,6 @@ private static int BuildBundle(BootstrapperOptions opts) Vital = false, Payloads = [dotNetRuntimePayload], }, - // TODO: right now we are including the Windows App Sdk in the bundle - // and always install it - // Microsoft makes it difficult to check if it exists from a regular installer: - // https://learn.microsoft.com/en-us/windows/apps/windows-app-sdk/check-windows-app-sdk-versions - // https://github.com/microsoft/WindowsAppSDK/discussions/2437 - new ExePackage // Windows App Sdk - { - PerMachine = true, - Permanent = true, - Cache = PackageCacheAction.remove, - // There is no license agreement for this SDK. - InstallArguments = "--quiet", - Vital = false, - Payloads = - [ - new ExePackagePayload - { - SourceFile = opts.WindowsAppSdkPath, - }, - ], - }, new MsiPackage(opts.MsiPath) { ForcePerMachine = true, diff --git a/scripts/Get-WindowsAppSdk.ps1 b/scripts/Get-WindowsAppSdk.ps1 deleted file mode 100644 index 48a25b6..0000000 --- a/scripts/Get-WindowsAppSdk.ps1 +++ /dev/null @@ -1,35 +0,0 @@ -# Usage: Get-WindowsAppSdk.ps1 -arch -param ( - [ValidateSet("x64", "arm64")] - [Parameter(Mandatory = $true)] - [string] $arch -) - -$ErrorActionPreference = "Stop" - -function Download-File([string] $url, [string] $outputPath, [string] $etagFile) { - Write-Host "Downloading '$url' to '$outputPath'" - # We use `curl.exe` here because `Invoke-WebRequest` is notoriously slow. - & curl.exe ` - --progress-bar ` - --show-error ` - --fail ` - --location ` - --etag-compare $etagFile ` - --etag-save $etagFile ` - --output $outputPath ` - $url - if ($LASTEXITCODE -ne 0) { throw "Failed to download $url" } - if (!(Test-Path $outputPath) -or (Get-Item $outputPath).Length -eq 0) { - throw "Failed to download '$url', output file '$outputPath' is missing or empty" - } -} - -# Download the Windows App Sdk binary from Microsoft for this platform if we don't have -# it yet (or it's different). -$windowsAppSdkMajorVersion = "1.8" -$windowsAppSdkFullVersion = "1.8.250907003" -$windowsAppSdkPath = Join-Path $PSScriptRoot "files\windows-app-sdk-$($arch).exe" -$windowsAppSdkUri = "https://aka.ms/windowsappsdk/$($windowsAppSdkMajorVersion)/$($windowsAppSdkFullVersion)/windowsappruntimeinstall-$($arch).exe" -$windowsAppSdkEtagFile = $windowsAppSdkPath + ".etag" -Download-File $windowsAppSdkUri $windowsAppSdkPath $windowsAppSdkEtagFile diff --git a/scripts/Publish.ps1 b/scripts/Publish.ps1 index 6c0c101..7c575fd 100644 --- a/scripts/Publish.ps1 +++ b/scripts/Publish.ps1 @@ -119,7 +119,7 @@ $servicePublishDir = Join-Path $buildPath "service" & dotnet.exe publish .\Vpn.Service\Vpn.Service.csproj -c Release -a $arch -o $servicePublishDir /p:Version=$version if ($LASTEXITCODE -ne 0) { throw "Failed to build Vpn.Service" } # App needs to be built with msbuild -$appPublishDir = Join-Path $buildPath "app" +$appPublishDir = Join-Path $buildPath "app\" $msbuildBinary = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe if ($LASTEXITCODE -ne 0) { throw "Failed to find MSBuild" } if (-not (Test-Path $msbuildBinary)) { throw "Failed to find MSBuild at $msbuildBinary" } @@ -175,10 +175,6 @@ Copy-Item $mutagenAgentsSrcPath $mutagenAgentsDestPath if ($LASTEXITCODE -ne 0) { throw "Failed to build MSI" } Add-CoderSignature $msiOutputPath -$getWindowsAppSdk = Join-Path $scriptRoot "Get-WindowsAppSdk.ps1" -& $getWindowsAppSdk -arch $arch -$windowsAppSdkPath = Join-Path $scriptRoot "files\windows-app-sdk-$($arch).exe" - # Build the bootstrapper & dotnet.exe run --project .\Installer\Installer.csproj -c Release -- ` build-bootstrapper ` @@ -188,7 +184,6 @@ $windowsAppSdkPath = Join-Path $scriptRoot "files\windows-app-sdk-$($arch).exe" --output-path $outputPath ` --icon-file "App\coder.ico" ` --msi-path $msiOutputPath ` - --windows-app-sdk-path $windowsAppSdkPath ` --theme-xml-path "scripts\files\RtfThemeLarge.xml" ` --logo-png "scripts\files\logo.png" if ($LASTEXITCODE -ne 0) { throw "Failed to build bootstrapper" }