Add Reactor (Microsoft.UI.Reactor) dotnet new templates#6620
Conversation
Adds four Reactor project templates to the Microsoft.WindowsAppSDK.WinUI.CSharp.Templates dotnet-new pack, mirroring the WinUI templates but for Microsoft.UI.Reactor (pure C#, no XAML): - Reactor Blank App (reactor, reactor-blank) - Reactor MVU App (reactor-mvu) - Reactor NavigationView (reactor-navview) - Reactor TabView App (reactor-tabview) Wired into dev/Templates/templates.props via the DotnetNewOnlyProjectTemplate slot (dotnet-new only, no VSIX, no manifest; Reactor apps run unpackaged). Each shares a common csproj referencing Microsoft.UI.Reactor + Microsoft.WindowsAppSDK, bundles the WinAppSDK runtime self-contained, and enables the Debug-only Reactor devtools surface. README and Test-DotnetNewTemplates.ps1 updated to document and validate the new templates. Validated end-to-end: pack -> install -> dotnet new -> build (Debug + Release) for all four templates. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
TitleBar(...).Icon(FontIcon(...)) threw System.ArgumentException (E_INVALIDARG) at runtime when Reactor set TitleBar.IconSource on Windows App SDK 2.1.3, so the scaffolded Blank, MVU, and TabView apps crashed on launch. The glyph was only a placeholder, so drop the icon; the title bar still shows the title text and all four templates now launch cleanly (validated with dotnet run). Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
microsoft/microsoft-ui-reactor#855 fixes the IconResolver FontSize=NaN crash (FontIcon in an IconSource slot without an explicit size threw ArgumentException from TitleBar.set_IconSource). That fix ships in Microsoft.UI.Reactor 0.1.0-preview.12, so restore the placeholder title-bar app-mark icon in the Blank, MVU, and TabView templates and bump the default reactorVersion 0.1.0-preview.11 -> 0.1.0-preview.12 across all four templates. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
/azp run |
|
Azure Pipelines: Successfully started running 2 pipeline(s). 1 pipeline(s) were filtered out due to trigger conditions. |
The template smoke-test stage installed only .NET SDK 8.0.x, so scaffolding and building the Reactor templates failed with NETSDK1045 (Reactor targets net10.0 and declares a [10.0,) sdk-version constraint). The WinUI templates auto-detect their TFM from the active SDK, so they built net8.0 and passed, masking the gap. Add a second UseDotNet@2 step (param reactorDotnetSdkVersion, default 10.0.x) to the shared Test-Stage template so the agent has the .NET 10 SDK. Verified locally that the WinUI templates still build cleanly on the .NET 10 SDK, so existing coverage is unaffected. Both the official and PR pipelines consume this shared stage. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
/azp run |
|
Azure Pipelines: Successfully started running 2 pipeline(s). 1 pipeline(s) were filtered out due to trigger conditions. |
| @@ -0,0 +1,18 @@ | |||
| { | |||
| "//": "Default F5 / `dotnet run` profiles for the scaffolded Reactor app.", | |||
There was a problem hiding this comment.
Why are we having these comments in launchsettings.json files? Some of these contents overlap with those in the package's README.
Can we remove them?
| <Platforms>x64;ARM64;x86</Platforms> | ||
| <UseWinUI>true</UseWinUI> | ||
| <!-- Reactor apps run unpackaged. --> | ||
| <WindowsPackageType>None</WindowsPackageType> |
There was a problem hiding this comment.
Why not make them packaged apps? Dotnet run supports packaged apps now.
@azchohfi You can reference the existing winui templates, when you launch them, there will be an app id.
| @@ -0,0 +1,51 @@ | |||
| <Project Sdk="Microsoft.NET.Sdk"> | |||
| { | ||
| public override Element Render() | ||
| { | ||
| var (selectedIndex, setSelectedIndex) = UseState(0); |
There was a problem hiding this comment.
Hi @azchohfi, can we integrate the tabs into the title bar? That would be cleaner and save some vertical space.
You can reference the winui-tabview template about the config.

in contrast, the current reactor-tabview is stacking tabs below title bar:

| "identity": "Microsoft.WindowsAppSDK.Reactor.CSharp.BlankApp", | ||
| "groupIdentity": "Microsoft.WindowsAppSDK.Reactor.CSharp.BlankApp", | ||
| "name": "Reactor Blank App", | ||
| "shortName": [ "reactor", "reactor-blank" ], |
There was a problem hiding this comment.
Right now these new templates will be found by "dotnet new list reactor".
Can we also have some short names starts with "winui-"? like,
"shortName": [
"reactor",
"reactor-blank",
"winui-reactor"
]
so that our users can see there're new templates when they run "dotnet new list winui" command with the new package?
@azchohfi, @niels9001 , @Scottj1s , @beth-panx How do you like this suggestion?




Summary
Adds four Reactor (
Microsoft.UI.Reactor) project templates to the existingMicrosoft.WindowsAppSDK.WinUI.CSharp.Templatesdotnet newpack, mirroring the WinUI templates from #6407 but for Reactor's declarative, pure-C# (no XAML) model.reactor,reactor-blankreactor-mvuUseReducerreactor-navviewNavigationViewshell with multiple pagesreactor-tabviewTabViewshell with multiple tabsWhat changed
dev/Templates/templates.props— four new rows in theDotnetNewOnlyProjectTemplateslot (dotnet-new only, no VSIX). Reactor apps run unpackaged, so there is noPackage.appxmanifest(RenameManifestFromleft unset). This reuses the repo's existing single-source-of-truth pack pipeline.dev/Templates/Source/ProjectTemplates/Desktop/CSharp/Reactor*— the app sources: a sharedProjectTemplate.csproj(referencesMicrosoft.UI.Reactor+Microsoft.WindowsAppSDK,WindowsAppSDKSelfContained, Debug-only Reactor devtools), a single-fileApp.csper pattern, andProperties/launchSettings.json(default + Devtools F5 profiles).dev/Templates/Dotnet/templates/reactor-*— the.template.configfor each (template.json,dotnetcli.host.json,ide.host.json,icon.png). Defaults: Reactor0.1.0-preview.12, Windows App SDK2.1.3,net10.0; overridable via--reactor-version/--wasdk-version.dev/Templates/Dotnet/README.md— documents the new Reactor templates.dev/Templates/Dotnet/Test-DotnetNewTemplates.ps1— adds the four to the scaffold/build validation loop.Validation
Validated end-to-end against the live
Microsoft.UI.Reactor 0.1.0-preview.12:dotnet pack→dotnet new install→ all four register →dotnet new→dotnet build(Debug + Release) →dotnet run. All four launch cleanly, including the title-bar app-mark icon (which relies on theIconResolverfix from microsoft/microsoft-ui-reactor#855, shipped in preview.12).A Microsoft employee must use
/azp runto validate using the PR pipelines.