@@ -116,6 +116,9 @@ public class BootstrapperOptions : SharedOptions
116116 [ Option ( 'm' , "msi-path" , Required = true , HelpText = "Path to the MSI package to embed" ) ]
117117 public string MsiPath { get ; set ; }
118118
119+ [ Option ( 'w' , "windows-app-sdk-path" , Required = true , HelpText = "Path to the Windows App Sdk package to embed" ) ]
120+ public string WindowsAppSdkPath { get ; set ; }
121+
119122 public new void Validate ( )
120123 {
121124 base . Validate ( ) ;
@@ -124,6 +127,8 @@ public class BootstrapperOptions : SharedOptions
124127 throw new ArgumentException ( $ "Logo PNG file not found at '{ LogoPng } '", nameof ( LogoPng ) ) ;
125128 if ( ! SystemFile . Exists ( MsiPath ) )
126129 throw new ArgumentException ( $ "MSI package not found at '{ MsiPath } '", nameof ( MsiPath ) ) ;
130+ if ( ! SystemFile . Exists ( WindowsAppSdkPath ) )
131+ throw new ArgumentException ( $ "Windows App Sdk package not found at '{ WindowsAppSdkPath } '", nameof ( WindowsAppSdkPath ) ) ;
127132 }
128133}
129134
@@ -337,16 +342,11 @@ private static int BuildBundle(BootstrapperOptions opts)
337342 {
338343 opts . Validate ( ) ;
339344
340- if ( ! DotNetRuntimePackagePayloads . TryGetValue ( opts . Platform , out var payload ) )
345+ if ( ! DotNetRuntimePackagePayloads . TryGetValue ( opts . Platform , out var dotNetRuntimePayload ) )
341346 throw new ArgumentException ( $ "Invalid architecture '{ opts . Platform } ' specified", nameof ( opts . Platform ) ) ;
342347
343- // TODO: it would be nice to include the WindowsAppRuntime but
344- // Microsoft makes it difficult to check from a regular
345- // installer:
346- // https://learn.microsoft.com/en-us/windows/apps/windows-app-sdk/check-windows-app-sdk-versions
347- // https://github.com/microsoft/WindowsAppSDK/discussions/2437
348348 var bundle = new Bundle ( ProductName ,
349- new ExePackage
349+ new ExePackage // .NET Runtime
350350 {
351351 PerMachine = true ,
352352 // Don't uninstall the runtime when the bundle is uninstalled.
@@ -362,7 +362,28 @@ private static int BuildBundle(BootstrapperOptions opts)
362362 // anyway. The MSI will fatally exit if the runtime really isn't
363363 // available, and the user can install it themselves.
364364 Vital = false ,
365- Payloads = [ payload ] ,
365+ Payloads = [ dotNetRuntimePayload ] ,
366+ } ,
367+ // TODO: right now we are including the Windows App Sdk in the bundle
368+ // and always install it
369+ // Microsoft makes it difficult to check if it exists from a regular installer:
370+ // https://learn.microsoft.com/en-us/windows/apps/windows-app-sdk/check-windows-app-sdk-versions
371+ // https://github.com/microsoft/WindowsAppSDK/discussions/2437
372+ new ExePackage // Windows App Sdk
373+ {
374+ PerMachine = true ,
375+ Permanent = true ,
376+ Cache = PackageCacheAction . remove ,
377+ // There is no license agreement for this SDK.
378+ InstallArguments = "--quiet" ,
379+ Vital = false ,
380+ Payloads =
381+ [
382+ new ExePackagePayload
383+ {
384+ SourceFile = opts . WindowsAppSdkPath
385+ }
386+ ] ,
366387 } ,
367388 new MsiPackage ( opts . MsiPath )
368389 {
0 commit comments