Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

added windows app sdk fetching and bundling into the installer#66

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ibetitsmike merged 3 commits intomainfrommike/add-windows-app-sdk
Apr 1, 2025
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 29 additions & 8 deletionsInstaller/Program.cs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -116,6 +116,9 @@ public class BootstrapperOptions : SharedOptions
[Option('m',"msi-path",Required=true,HelpText="Path to the MSI package to embed")]
publicstringMsiPath{get;set;}

[Option('w',"windows-app-sdk-path",Required=true,HelpText="Path to the Windows App Sdk package to embed")]
publicstringWindowsAppSdkPath{get;set;}

publicnewvoidValidate()
{
base.Validate();
Expand All@@ -124,6 +127,8 @@ public class BootstrapperOptions : SharedOptions
thrownewArgumentException($"Logo PNG file not found at '{LogoPng}'",nameof(LogoPng));
if(!SystemFile.Exists(MsiPath))
thrownewArgumentException($"MSI package not found at '{MsiPath}'",nameof(MsiPath));
if(!SystemFile.Exists(WindowsAppSdkPath))
thrownewArgumentException($"Windows App Sdk package not found at '{WindowsAppSdkPath}'",nameof(WindowsAppSdkPath));
}
}

Expand DownExpand Up@@ -337,16 +342,11 @@ private static int BuildBundle(BootstrapperOptions opts)
{
opts.Validate();

if(!DotNetRuntimePackagePayloads.TryGetValue(opts.Platform,outvarpayload))
if(!DotNetRuntimePackagePayloads.TryGetValue(opts.Platform,outvardotNetRuntimePayload))
thrownewArgumentException($"Invalid architecture '{opts.Platform}' specified",nameof(opts.Platform));

// TODO: it would be nice to include the WindowsAppRuntime but
// Microsoft makes it difficult to check 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
varbundle=newBundle(ProductName,
newExePackage
newExePackage// .NET Runtime
{
PerMachine=true,
// Don't uninstall the runtime when the bundle is uninstalled.
Expand All@@ -362,7 +362,28 @@ private static int BuildBundle(BootstrapperOptions opts)
// anyway. The MSI will fatally exit if the runtime really isn't
// available, and the user can install it themselves.
Vital=false,
Payloads=[payload],
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
newExePackage// Windows App Sdk
{
PerMachine=true,
Permanent=true,
Cache=PackageCacheAction.remove,
// There is no license agreement for this SDK.
InstallArguments="--quiet",
Vital=false,
Payloads=
[
newExePackagePayload
{
SourceFile=opts.WindowsAppSdkPath
}
],
},
newMsiPackage(opts.MsiPath)
{
Expand Down
34 changes: 34 additions & 0 deletionsscripts/Get-WindowsAppSdk.ps1
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
# Usage: Get-WindowsAppSdk.ps1 -arch <x64|arm64>
param (
[ValidateSet("x64","arm64")]
[Parameter(Mandatory=$true)]
[string]$arch
)

functionDownload-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`
-v`
--show-error`
--fail`
--location`
--etag-compare$etagFile`
--etag-save$etagFile`
--output$outputPath`
$url
if ($LASTEXITCODE-ne0) {throw"Failed to download$url" }
if (!(Test-Path$outputPath)-or (Get-Item$outputPath).Length-eq0) {
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.6"
$windowsAppSdkFullVersion="1.6.250228001"
$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
5 changes: 5 additions & 0 deletionsscripts/Publish.ps1
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -175,6 +175,10 @@ Copy-Item $mutagenAgentsSrcPath $mutagenAgentsDestPath
if ($LASTEXITCODE-ne0) {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`
Expand All@@ -184,6 +188,7 @@ Add-CoderSignature $msiOutputPath
--output-path$outputPath`
--icon-file"App\coder.ico"`
--msi-path$msiOutputPath`
--windows-app-sdk-path$windowsAppSdkPath`
--logo-png"scripts\files\logo.png"
if ($LASTEXITCODE-ne0) {throw"Failed to build bootstrapper" }

Expand Down
1 change: 1 addition & 0 deletionsscripts/files/.gitignore
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
mutagen-*.tar.gz
mutagen-*.exe
*.etag
windows-app-sdk-*.exe
Loading

[8]ページ先頭

©2009-2025 Movatter.jp