Repository navigation
Add Reactor single-file app template (reactor-singlefile) - #6844
Merged
Alexandre Zollinger Chohfi (azchohfi) merged 3 commits intoOct 15, 2026
Merged
Alexandre Zollinger Chohfi (azchohfi) merged 3 commits into
Alexandre Zollinger Chohfi (azchohfi) merged 3 commits into
Conversation
Adds a "Reactor Single-File App (Experimental)" template to the Microsoft.WindowsAppSDK.WinUI.CSharp.Templates dotnet new pack. It scaffolds the blank Microsoft.UI.Reactor app as a single-file .NET 10 file-based app: one <name>.cs whose #:package / #:property directives replace the .csproj. It runs packaged by default: for `dotnet run <name>.cs`, Microsoft.Windows.SDK.BuildTools.WinApp 0.7.0+ synthesizes an appxmanifest from the directives and launches the app with package identity. The name follows Aspire's aspire-apphost-singlefile, the only first-party dotnet new template for a .NET file-based app. - templates.props: new DotnetNewOnlyProjectTemplate row (reactor.singlefile) and an IncludeGitignore metadata opt-out (default true) so the scaffolded output stays that single file. - WinAppSdk.CSharp.DotnetNewTemplates.csproj: honor IncludeGitignore=false. - reactor-singlefile-app/.template.config: short names reactor-singlefile and winui-reactor-singlefile (winapp new enumerates with `dotnet new list winui`), and hidden from the Visual Studio New Project dialog through ide.host.json unsupportedHosts, since VS cannot open a file-based app. - The file references Microsoft.WindowsAppSDK: with Microsoft.UI.Reactor 0.1.0-preview.16 alone the Windows App SDK defaults to self-contained and the build fails. - README and Test-DotnetNewTemplates.ps1 (new FileBasedApp kind) updated. 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. |
Contributor
Author
|
/azp run |
Alexandre Zollinger Chohfi (azchohfi)
requested review from
Dinah Xiaoman G (DinahK-2SO) and
Lauren Ciha (lauren-ciha)
October 6, 2026 20:49
Alexandre Zollinger Chohfi (azchohfi)
enabled auto-merge (squash)
October 6, 2026 20:49
14 tasks done
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Contributor
Author
|
/azp run |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
Contributor
|
Tried this out locally next to the four Reactor Two visual differences compared to the
Tracking this in microsoft/winappCli#1077. We'll fix it there, so the template can stay a single file. I don't think this blocks the PR. |
Contributor
Author
Thanks for trying it next to the |
Niels Laute (niels9001)
approved these changes
Oct 15, 2026
Contributor
Author
|
/azp run |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
Alexandre Zollinger Chohfi (azchohfi)
deleted the
azchohfi-reactor-singlefile-template
branch
October 15, 2026 20:27
This was referenced Oct 15, 2026
Nikola Metulev (nmetulev)
added a commit
to microsoft/winappCli
that referenced
this pull request
Oct 16, 2026
…1109) ## What and why After `winapp new -t reactor-singlefile -n MyApp`, winapp told you to run `winapp run` from the new folder. That fails with `Manifest file not found`, because `winapp run` treats an app as a single-file (.NET file-based) app only when you pass the `.cs` file. Now the next step names the file, so you can copy and run it. winapp knows the template made a single-file app if either of these is true: - the template has the `SingleFile` tag, or - the new folder has `MyApp.cs` and no `.csproj`. The file check is a fallback: `dotnet new list` sometimes cuts off long Tags columns, so the `SingleFile` tag can be missing. Fixes #1107 ## Before / after `reactor-singlefile` isn't in a published template pack yet, so I couldn't run it end to end or take screenshots. The "after" text below is the real output from the new unit test, which fakes the `dotnet new` call. **Before** (from the issue): ``` 👉 Next: cd "MyApp" then winapp run. ``` **After**: ``` ✅ Created WinUI app MyApp at ...\MyApp. ⚠ reactor-singlefile is an experimental template. It depends on prerelease packages whose APIs can change or be removed in a future release. 👉 Next: cd "MyApp" then winapp run "MyApp.cs". ``` Other templates still print the same next steps as before. ## Not tested / risks - I haven't run this against a real `reactor-singlefile` pack, because none is published yet. The tests use the tags from the template's `template.json` in microsoft/WindowsAppSDK#6844. ## Checklist - [x] Tests added or updated - [x] Tested locally on Windows <details><summary>Notes for reviewers</summary> The file name is quoted (`winapp run "MyApp.cs"`) so names with spaces work. `winapp new` accepts a name like `My App`, and without quotes `winapp run My App.cs` would take `App.cs` as an app argument. </details> --------- Co-authored-by: Nikola Metulev <nmetulev@users.noreply.github.com> Copilot-Session: a2691a0e-67c7-434a-9a69-33559c878e0c
Alexandre Zollinger Chohfi (azchohfi)
added a commit
that referenced
this pull request
Oct 21, 2026
Resolve the README conflict with the new reactor-singlefile template (#6844), keeping its quickstart pointer and dropping the --wasdk-version mention. Apply the same change to reactor-singlefile that this PR makes to the other Reactor templates: remove the `#:package Microsoft.WindowsAppSDK` directive and the windowsAppSdkVersion / --wasdk-version parameter, and default reactorVersion to 0.1.0-preview.17, which carries Microsoft.WindowsAppSDK.Runtime. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 of 7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a Reactor Single-File App template to the
Microsoft.WindowsAppSDK.WinUI.CSharp.Templatesdotnet newpack, alongside the four Reactor templates from #6620. It scaffolds the blank Reactor (Microsoft.UI.Reactor) app as a single-file .NET 10 file-based app: one.csfile whose#:package/#:propertydirectives replace the.csproj. This is the shape Reactor's getting-started guide documents under One file, no project (microsoft/microsoft-ui-reactor#1283).reactor-singlefile,winui-reactor-singlefile<name>.cs, with no.csproj, assets or manifestThe generated
MyApp.cswith default parameters (the body is the same as thereactorblank app):What changed
dev/Templates/Source/ProjectTemplates/Desktop/CSharp/ReactorSingleFileApp/ProjectTemplate.csis the whole template: the directive header above plus theReactorBlankApp/App.csbody.sourceNamerenames it to<name>.cs, so the assembly name and the synthesized package identity follow the project name.dev/Templates/Dotnet/templates/reactor-singlefile-app/.template.config(template.json,dotnetcli.host.json,ide.host.json,icon.png):Microsoft.WindowsAppSDK.Reactor.CSharp.SingleFileApp; classifications areWindows/WinUI/Desktop/Reactor/SingleFile/Experimental.--dotnet-version(net10.0),--reactor-version(0.1.0-preview.16),--wasdk-version(*, 2.2.0 or later),--windowsSdkBuildToolsWinAppVersion(*, 0.7.0 or later) and--no-restore.dotnet restore <name>.cs, which works on a.csprimary output.dev/Templates/templates.props:reactor.singlefilerow in theDotnetNewOnlyProjectTemplateslot.IncludeGitignoremetadata value (defaulttrue). The new template sets it tofalseso its output stays a single file.dev/Templates/Dotnet/WinAppSdk.CSharp.DotnetNewTemplates.csproj: the pack task skips the shared.gitignorewhenIncludeGitignore=false. Every other template's packed file list is unchanged.dev/Templates/Dotnet/README.md: adds a table row, a "Quickstart a single-file Reactor app" section, and a note on setting theWinAppRun*properties with#:propertyin a single-file app.dev/Templates/Dotnet/Test-DotnetNewTemplates.ps1: a minimalFileBasedAppkind, named after the .NET mechanism. It asserts that the scaffold is exactly<name>.cs, then runsdotnet build <name>.csin the default (packaged) configuration.Design notes
dotnet newtemplate for a .NET file-based app, Aspire'saspire-apphost-singlefile("Aspire Single-File App Host", classificationSingleFile). The descriptions and README keep the official .NET term file-based app, which also separates this fromPublishSingleFile.Microsoft.WindowsAppSDK. With the publishedMicrosoft.UI.Reactor0.1.0-preview.16 alone, the Windows App SDK defaults to self-contained and the build fails withWindowsAppSDKSelfContained requires a supported Windows architecture. The Runtime dependency restored by Restore the Windows App Runtime dependency and document single-file apps microsoft-ui-reactor#1283 hasn't shipped yet. Referencing the metapackage, as the sibling templates do, makes the app framework-dependent and keeps--wasdk-versionmeaningful.dotnet run <file>.cs(Run a .NET file-based app with package identity winappCli#794, Support packaged dotnet run for .NET file-based apps winappCli#874) is new inMicrosoft.Windows.SDK.BuildTools.WinApp0.7.0. With 0.6.1,_WinAppRunSupportActivestaysfalse, sodotnet runstarts the unpackaged exe and the app fails at startup.publisherDn,publisherDisplay,guid9and the Windows SDK BuildTools pin were dropped.Microsoft.Windows.SDK.BuildToolscomes in transitively.#:packagecan't be Debug-only and file-based apps default toPublishAot=true..csproj, there's noapp.manifest, since Reactor sets PerMonitorV2 DPI awareness itself.ide.host.jsonsets"unsupportedHosts": [{ "id": "vs" }], because a file-based app has no project for VS to open. The Aspire single-file template linked above does the same. The .NET CLI ignoreside.host.json, sodotnet newandwinapp neware unaffected.winui-reactor-singlefilealias.winapp newfinds templates withdotnet new list winui, which matches names and short names only. Like the other Reactor templates, this one carries awinui-reactor*alias sowinapp new --listandwinapp new -t reactor-singlefilepick it up.Validation
Local runs used .NET SDK 10.0.401, winapp 0.7.0 and Developer Mode, against the template pack packed from this change.
dotnet pack:content/reactor.singlefile/holdsProjectTemplate.csplus the four.template.configfiles and nogitignore.txt. Compared with the published0.0.7-alpha, the only content difference is those 5 new entries; the 10 sibling project templates still get theirgitignore.txt.dotnet new list winuianddotnet new list reactorboth listReactor Single-File App (Experimental) reactor-singlefile,winui-reactor-singlefile.dotnet new reactor-singlefile -n MyAppcreates exactlyMyApp\MyApp.csand printsRestoring ...\MyApp\MyApp.cs: ... Restore succeeded..dotnet build MyApp.csin Debug and Release: 0 warnings, 0 errors..csfile; the output goes to%TEMP%\dotnet\runfile\.dotnet run MyApp.csprints✅ Manifest generated for MyApp-53b1794c 1.0.0.0and thenlaunched. The window titled "MyApp" opens, andGetPackageFullNameon the process returnsMyApp-53b1794c_1.0.0.0_x64__gspb8g6x97k2t(AUMID…!App). The package is a dev-mode registration with a dependency onMicrosoft.WindowsAppRuntime.22.5.1.0.#:property WindowsPackageType=Noneadded,dotnet runopens the window, the process has no package identity (APPMODEL_ERROR_NO_PACKAGE), and nothing is registered.winapp run MyApp.cs --detachlaunches the same identity.#:property WinAppRunNoLaunch=trueregisters the app without launching it (checks the README note).dotnet publish MyApp.cs(Native AOT, the default for file-based apps).\artifacts\MyApp\MyApp.exewith 0 warnings.%ProgramFiles(x86)%\Microsoft Visual Studio\Installeris onPATH. Without that, VS 18'svcvarsallfails with'vswhere.exe' is not recognized. This is a toolchain environment issue, not a template one.winapp new --list --template-version installedlistsReactor Single-File App (Experimental) │ reactor-singlefile.winapp new -t reactor-singlefile -n WinappAppscaffoldsWinappApp\WinappApp.cs.--wasdk-version 2.2.0(the documented floor) builds with 0 warnings.Test-DotnetNewTemplates.ps1 -PackagePath <local nupkg> -SkipAppLaunch:All templates validated successfully.41 summary rows areSucceeded: the 6 WinUI and 4 existing Reactor project templates, the newreactor-singlefile(createandbuild, where the build step first asserts the scaffold is a single file), the 7 item templates and the version scenarios. The oneSkippedrow is the default-wildcard build, which the script skips whenever*resolves to a concrete version.winuibuild before any Reactor template ran. That is a network problem on my end, not this change. The passing run used a byte-identical copy of the script whose generatedNuGet.configpoints at a nuget.org proxy. The WindowsAppSDK-Templates-PR pipeline runs the script against the internal feed.Follow-up (outside this repo)
winapp newends withNext: cd "<name>" then winapp run. For a single-file template that fails withManifest file not found, becausewinapp runonly enters single-file mode for an explicit.cspath. The correct command iswinapp run <name>.cs(ordotnet run <name>.cs). That hint needs a fix in winappCli; this template's comments and the README already give the right command..csprojtemplates (Single-file (file-based) apps: taskbar icon drawn on accent plate and title bar icon missing winappCli#1077). The taskbar icon is drawn on an accent-colored plate, because the generatedresources.pridoesn't index the unplatedAppList*assets. The title bar has no icon, because the exe has no embedded.ico. Both need a fix in winapp; the template can't fix them without adding files next to the.cs.A Microsoft employee must use
/azp runto validate using the PR pipelines.