From df12a00f6e79c7d037179ab8ffc8a6e44a429ed5 Mon Sep 17 00:00:00 2001 From: Alexandre Zollinger Chohfi Date: Tue, 6 Oct 2026 13:56:55 -0700 Subject: [PATCH] Reactor templates: drop the Microsoft.WindowsAppSDK metapackage reference The Reactor dotnet-new templates referenced the full Microsoft.WindowsAppSDK metapackage, which also pulls in the AI, ML, Search, Widgets and DWrite components. Their native payload (onnxruntime.dll, DirectML.dll, ...) is copied into every app and can't be removed by trimming or Native AOT. Starting with Microsoft.UI.Reactor 0.1.0-preview.17 (microsoft/microsoft-ui-reactor#1283), Reactor depends on Microsoft.WindowsAppSDK.WinUI and Microsoft.WindowsAppSDK.Runtime, so the templates get a framework-dependent Windows App SDK transitively and no longer need their own reference. - Remove the Microsoft.WindowsAppSDK PackageReference from the four Reactor project templates. - Bump the default reactorVersion to 0.1.0-preview.17. - Remove the now-unused windowsAppSdkVersion / --wasdk-version parameter. - Stop passing --wasdk-version to Reactor templates in Test-DotnetNewTemplates.ps1. - Document the behavior in the dotnet-new README. Discussion: microsoft/microsoft-ui-reactor#1280 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- dev/Templates/Dotnet/README.md | 13 +++++++++++-- dev/Templates/Dotnet/Test-DotnetNewTemplates.ps1 | 5 ++++- .../.template.config/dotnetcli.host.json | 5 ----- .../.template.config/ide.host.json | 7 ------- .../.template.config/template.json | 9 +-------- .../.template.config/dotnetcli.host.json | 5 ----- .../reactor-mvu-app/.template.config/ide.host.json | 7 ------- .../reactor-mvu-app/.template.config/template.json | 9 +-------- .../.template.config/dotnetcli.host.json | 5 ----- .../.template.config/ide.host.json | 7 ------- .../.template.config/template.json | 9 +-------- .../.template.config/dotnetcli.host.json | 5 ----- .../.template.config/ide.host.json | 7 ------- .../.template.config/template.json | 9 +-------- .../CSharp/ReactorBlankApp/ProjectTemplate.csproj | 1 - .../CSharp/ReactorMvuApp/ProjectTemplate.csproj | 1 - .../ReactorNavigationApp/ProjectTemplate.csproj | 1 - .../CSharp/ReactorTabViewApp/ProjectTemplate.csproj | 1 - 18 files changed, 19 insertions(+), 87 deletions(-) diff --git a/dev/Templates/Dotnet/README.md b/dev/Templates/Dotnet/README.md index cfede35b79..4f50b85de1 100644 --- a/dev/Templates/Dotnet/README.md +++ b/dev/Templates/Dotnet/README.md @@ -65,8 +65,17 @@ Reactor apps are packaged (single-project MSIX) and reference the preview NuGet package. They require .NET 10 or later. Like the WinUI templates, they reference `Microsoft.Windows.SDK.BuildTools.WinApp` so `dotnet run` launches the app with full MSIX package identity. Pin a specific Reactor package version -at scaffold time with `--reactor-version`, or the Windows App SDK version with -`--wasdk-version`. +at scaffold time with `--reactor-version`. + +The Reactor templates don't reference the `Microsoft.WindowsAppSDK` metapackage. +`Microsoft.UI.Reactor` brings in only the Windows App SDK packages it needs +(`Microsoft.WindowsAppSDK.WinUI` and `Microsoft.WindowsAppSDK.Runtime`) +transitively. This keeps the AI and ML components (for example +`onnxruntime.dll` and `DirectML.dll`) out of the app, including trimmed and +Native AOT publishes. To use another Windows App SDK component, add its package +yourself, or reference the full `Microsoft.WindowsAppSDK` metapackage. The +version you pick must match the `Microsoft.WindowsAppSDK.Runtime` version that +Reactor brings in. ### Item Templates diff --git a/dev/Templates/Dotnet/Test-DotnetNewTemplates.ps1 b/dev/Templates/Dotnet/Test-DotnetNewTemplates.ps1 index ce692812dd..bed426fe82 100644 --- a/dev/Templates/Dotnet/Test-DotnetNewTemplates.ps1 +++ b/dev/Templates/Dotnet/Test-DotnetNewTemplates.ps1 @@ -358,7 +358,10 @@ function Test-WinUiProjectTemplate { $projectName = '{0}_{1}_{2}' -f $TemplateShortName, $Platform, ([Guid]::NewGuid().ToString('N').Substring(0, 8)) $projectPath = Join-Path -Path $WorkingRoot -ChildPath $projectName - New-ProjectFromTemplate -TemplateShortName $TemplateShortName -ProjectName $projectName -OutputPath $projectPath -WorkingDirectory $WorkingRoot -WindowsAppSdkVersion $script:windowsAppSdkVersion + # Reactor templates have no --wasdk-version option: Windows App SDK comes + # transitively from Microsoft.UI.Reactor (WinUI + Runtime), not the metapackage. + $wasdkVersion = if ($TemplateShortName -like 'reactor*') { $null } else { $script:windowsAppSdkVersion } + New-ProjectFromTemplate -TemplateShortName $TemplateShortName -ProjectName $projectName -OutputPath $projectPath -WorkingDirectory $WorkingRoot -WindowsAppSdkVersion $wasdkVersion Add-Result -Template $TemplateShortName -Platform $Platform -Step 'create' -Status 'Succeeded' -Path $projectPath $projectFile = Join-Path -Path $projectPath -ChildPath "$projectName.csproj" diff --git a/dev/Templates/Dotnet/templates/reactor-blank-app/.template.config/dotnetcli.host.json b/dev/Templates/Dotnet/templates/reactor-blank-app/.template.config/dotnetcli.host.json index 14bee23ae2..50bbe39922 100644 --- a/dev/Templates/Dotnet/templates/reactor-blank-app/.template.config/dotnetcli.host.json +++ b/dev/Templates/Dotnet/templates/reactor-blank-app/.template.config/dotnetcli.host.json @@ -11,11 +11,6 @@ "shortName": "rv", "description": "Pin to a specific Microsoft.UI.Reactor NuGet version." }, - "windowsAppSdkVersion": { - "longName": "wasdk-version", - "shortName": "wasdkv", - "description": "Pin to a specific Windows App SDK NuGet version." - }, "skipRestore": { "longName": "no-restore", "shortName": "" diff --git a/dev/Templates/Dotnet/templates/reactor-blank-app/.template.config/ide.host.json b/dev/Templates/Dotnet/templates/reactor-blank-app/.template.config/ide.host.json index b82567c7a7..f06910379a 100644 --- a/dev/Templates/Dotnet/templates/reactor-blank-app/.template.config/ide.host.json +++ b/dev/Templates/Dotnet/templates/reactor-blank-app/.template.config/ide.host.json @@ -21,13 +21,6 @@ "text": "Microsoft.UI.Reactor version" }, "isVisible": "true" - }, - { - "id": "windowsAppSdkVersion", - "name": { - "text": "Windows App SDK version" - }, - "isVisible": "true" } ] } diff --git a/dev/Templates/Dotnet/templates/reactor-blank-app/.template.config/template.json b/dev/Templates/Dotnet/templates/reactor-blank-app/.template.config/template.json index a3962f67e0..f1d433d1dc 100644 --- a/dev/Templates/Dotnet/templates/reactor-blank-app/.template.config/template.json +++ b/dev/Templates/Dotnet/templates/reactor-blank-app/.template.config/template.json @@ -50,17 +50,10 @@ "reactorVersion": { "type": "parameter", "datatype": "text", - "defaultValue": "0.1.0-preview.16", + "defaultValue": "0.1.0-preview.17", "replaces": "$ReactorVersion$", "description": "Microsoft.UI.Reactor (and Microsoft.UI.Reactor.Devtools) NuGet version to reference." }, - "windowsAppSdkVersion": { - "type": "parameter", - "datatype": "text", - "defaultValue": "*", - "replaces": "$WindowsAppSdkVersion$", - "description": "Microsoft.WindowsAppSDK NuGet version. Requires 2.2.0 or later; use * for the latest stable." - }, "windowsSdkBuildToolsVersion": { "type": "parameter", "datatype": "text", diff --git a/dev/Templates/Dotnet/templates/reactor-mvu-app/.template.config/dotnetcli.host.json b/dev/Templates/Dotnet/templates/reactor-mvu-app/.template.config/dotnetcli.host.json index 14bee23ae2..50bbe39922 100644 --- a/dev/Templates/Dotnet/templates/reactor-mvu-app/.template.config/dotnetcli.host.json +++ b/dev/Templates/Dotnet/templates/reactor-mvu-app/.template.config/dotnetcli.host.json @@ -11,11 +11,6 @@ "shortName": "rv", "description": "Pin to a specific Microsoft.UI.Reactor NuGet version." }, - "windowsAppSdkVersion": { - "longName": "wasdk-version", - "shortName": "wasdkv", - "description": "Pin to a specific Windows App SDK NuGet version." - }, "skipRestore": { "longName": "no-restore", "shortName": "" diff --git a/dev/Templates/Dotnet/templates/reactor-mvu-app/.template.config/ide.host.json b/dev/Templates/Dotnet/templates/reactor-mvu-app/.template.config/ide.host.json index b82567c7a7..f06910379a 100644 --- a/dev/Templates/Dotnet/templates/reactor-mvu-app/.template.config/ide.host.json +++ b/dev/Templates/Dotnet/templates/reactor-mvu-app/.template.config/ide.host.json @@ -21,13 +21,6 @@ "text": "Microsoft.UI.Reactor version" }, "isVisible": "true" - }, - { - "id": "windowsAppSdkVersion", - "name": { - "text": "Windows App SDK version" - }, - "isVisible": "true" } ] } diff --git a/dev/Templates/Dotnet/templates/reactor-mvu-app/.template.config/template.json b/dev/Templates/Dotnet/templates/reactor-mvu-app/.template.config/template.json index a5523cb911..c52bc7b179 100644 --- a/dev/Templates/Dotnet/templates/reactor-mvu-app/.template.config/template.json +++ b/dev/Templates/Dotnet/templates/reactor-mvu-app/.template.config/template.json @@ -50,17 +50,10 @@ "reactorVersion": { "type": "parameter", "datatype": "text", - "defaultValue": "0.1.0-preview.16", + "defaultValue": "0.1.0-preview.17", "replaces": "$ReactorVersion$", "description": "Microsoft.UI.Reactor (and Microsoft.UI.Reactor.Devtools) NuGet version to reference." }, - "windowsAppSdkVersion": { - "type": "parameter", - "datatype": "text", - "defaultValue": "*", - "replaces": "$WindowsAppSdkVersion$", - "description": "Microsoft.WindowsAppSDK NuGet version. Requires 2.2.0 or later; use * for the latest stable." - }, "windowsSdkBuildToolsVersion": { "type": "parameter", "datatype": "text", diff --git a/dev/Templates/Dotnet/templates/reactor-navigation-app/.template.config/dotnetcli.host.json b/dev/Templates/Dotnet/templates/reactor-navigation-app/.template.config/dotnetcli.host.json index 14bee23ae2..50bbe39922 100644 --- a/dev/Templates/Dotnet/templates/reactor-navigation-app/.template.config/dotnetcli.host.json +++ b/dev/Templates/Dotnet/templates/reactor-navigation-app/.template.config/dotnetcli.host.json @@ -11,11 +11,6 @@ "shortName": "rv", "description": "Pin to a specific Microsoft.UI.Reactor NuGet version." }, - "windowsAppSdkVersion": { - "longName": "wasdk-version", - "shortName": "wasdkv", - "description": "Pin to a specific Windows App SDK NuGet version." - }, "skipRestore": { "longName": "no-restore", "shortName": "" diff --git a/dev/Templates/Dotnet/templates/reactor-navigation-app/.template.config/ide.host.json b/dev/Templates/Dotnet/templates/reactor-navigation-app/.template.config/ide.host.json index b82567c7a7..f06910379a 100644 --- a/dev/Templates/Dotnet/templates/reactor-navigation-app/.template.config/ide.host.json +++ b/dev/Templates/Dotnet/templates/reactor-navigation-app/.template.config/ide.host.json @@ -21,13 +21,6 @@ "text": "Microsoft.UI.Reactor version" }, "isVisible": "true" - }, - { - "id": "windowsAppSdkVersion", - "name": { - "text": "Windows App SDK version" - }, - "isVisible": "true" } ] } diff --git a/dev/Templates/Dotnet/templates/reactor-navigation-app/.template.config/template.json b/dev/Templates/Dotnet/templates/reactor-navigation-app/.template.config/template.json index ac9a031c14..7c1ca78dc3 100644 --- a/dev/Templates/Dotnet/templates/reactor-navigation-app/.template.config/template.json +++ b/dev/Templates/Dotnet/templates/reactor-navigation-app/.template.config/template.json @@ -50,17 +50,10 @@ "reactorVersion": { "type": "parameter", "datatype": "text", - "defaultValue": "0.1.0-preview.16", + "defaultValue": "0.1.0-preview.17", "replaces": "$ReactorVersion$", "description": "Microsoft.UI.Reactor (and Microsoft.UI.Reactor.Devtools) NuGet version to reference." }, - "windowsAppSdkVersion": { - "type": "parameter", - "datatype": "text", - "defaultValue": "*", - "replaces": "$WindowsAppSdkVersion$", - "description": "Microsoft.WindowsAppSDK NuGet version. Requires 2.2.0 or later; use * for the latest stable." - }, "windowsSdkBuildToolsVersion": { "type": "parameter", "datatype": "text", diff --git a/dev/Templates/Dotnet/templates/reactor-tabview-app/.template.config/dotnetcli.host.json b/dev/Templates/Dotnet/templates/reactor-tabview-app/.template.config/dotnetcli.host.json index 14bee23ae2..50bbe39922 100644 --- a/dev/Templates/Dotnet/templates/reactor-tabview-app/.template.config/dotnetcli.host.json +++ b/dev/Templates/Dotnet/templates/reactor-tabview-app/.template.config/dotnetcli.host.json @@ -11,11 +11,6 @@ "shortName": "rv", "description": "Pin to a specific Microsoft.UI.Reactor NuGet version." }, - "windowsAppSdkVersion": { - "longName": "wasdk-version", - "shortName": "wasdkv", - "description": "Pin to a specific Windows App SDK NuGet version." - }, "skipRestore": { "longName": "no-restore", "shortName": "" diff --git a/dev/Templates/Dotnet/templates/reactor-tabview-app/.template.config/ide.host.json b/dev/Templates/Dotnet/templates/reactor-tabview-app/.template.config/ide.host.json index b82567c7a7..f06910379a 100644 --- a/dev/Templates/Dotnet/templates/reactor-tabview-app/.template.config/ide.host.json +++ b/dev/Templates/Dotnet/templates/reactor-tabview-app/.template.config/ide.host.json @@ -21,13 +21,6 @@ "text": "Microsoft.UI.Reactor version" }, "isVisible": "true" - }, - { - "id": "windowsAppSdkVersion", - "name": { - "text": "Windows App SDK version" - }, - "isVisible": "true" } ] } diff --git a/dev/Templates/Dotnet/templates/reactor-tabview-app/.template.config/template.json b/dev/Templates/Dotnet/templates/reactor-tabview-app/.template.config/template.json index 423f744f53..9fc0ee5f64 100644 --- a/dev/Templates/Dotnet/templates/reactor-tabview-app/.template.config/template.json +++ b/dev/Templates/Dotnet/templates/reactor-tabview-app/.template.config/template.json @@ -50,17 +50,10 @@ "reactorVersion": { "type": "parameter", "datatype": "text", - "defaultValue": "0.1.0-preview.16", + "defaultValue": "0.1.0-preview.17", "replaces": "$ReactorVersion$", "description": "Microsoft.UI.Reactor (and Microsoft.UI.Reactor.Devtools) NuGet version to reference." }, - "windowsAppSdkVersion": { - "type": "parameter", - "datatype": "text", - "defaultValue": "*", - "replaces": "$WindowsAppSdkVersion$", - "description": "Microsoft.WindowsAppSDK NuGet version. Requires 2.2.0 or later; use * for the latest stable." - }, "windowsSdkBuildToolsVersion": { "type": "parameter", "datatype": "text", diff --git a/dev/Templates/Source/ProjectTemplates/Desktop/CSharp/ReactorBlankApp/ProjectTemplate.csproj b/dev/Templates/Source/ProjectTemplates/Desktop/CSharp/ReactorBlankApp/ProjectTemplate.csproj index 39f6a4a0c9..c18cebe3b7 100644 --- a/dev/Templates/Source/ProjectTemplates/Desktop/CSharp/ReactorBlankApp/ProjectTemplate.csproj +++ b/dev/Templates/Source/ProjectTemplates/Desktop/CSharp/ReactorBlankApp/ProjectTemplate.csproj @@ -44,7 +44,6 @@ -