Repository navigation
Add .NET file-based app sample and guide - #1066
Conversation
Adds samples/dotnet-file-app: a single app.cs run with 'winapp run app.cs' or 'dotnet run app.cs', with identity described by #:property directives and no manifest or assets. Covered by a Pester sample test and the test-samples CI matrix. Fixes #1064 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 722ef99e-56b6-4428-976b-3761e371b3d4
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 722ef99e-56b6-4428-976b-3761e371b3d4
…un warning in README Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 722ef99e-56b6-4428-976b-3761e371b3d4
There was a problem hiding this comment.
🟡 Changes recommended
The manual workflow selector omits dotnet-file-app, preventing maintainers from running that sample alone.
1 open finding
What changed in this PR
Adds a minimal .NET 10 file-based app sample demonstrating packaged identity without a project file or authored manifest.
Changes:
- Adds the sample, documentation, and two launch workflows.
- Adds Pester coverage and CI matrix integration.
- Updates sample listings and workflow assertions.
| File | Description |
|---|---|
samples/dotnet-file-app/app.cs |
Implements the single-file sample. |
samples/dotnet-file-app/README.md |
Documents usage and customization. |
samples/dotnet-file-app/test.Tests.ps1 |
Tests creation, launch, and cleanup. |
.github/workflows/test-samples.yml |
Adds the sample to CI. |
scripts/tests/artifact-workflow.Tests.ps1 |
Updates workflow expectations. |
README.md |
Lists the new sample. |
docs/usage.md |
Links to the complete example. |
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Build Metrics ReportValidation passed. All required build and validation jobs succeeded. Binary Sizes
.NET Test Results (TRX reports)Other suites are reflected in the overall validation status above. ✅ 8376 passed, 37 skipped out of 8413 tests in 1693.5s (+633.6s vs. baseline) Test Coverage✅ 87.6% line coverage, 82.3% branch coverage · ✅ no change vs. baseline CLI Startup Time53ms median (x64, Try This BuildInstalls the MSIX for your architecture, replacing any previously installed build. Needs the GitHub CLI — the command offers to install it and sign you in if it is missing. & ([scriptblock]::Create((irm https://raw.githubusercontent.com/microsoft/winappCli/main/scripts/winapp-pr.ps1))) 1066Switching between builds often?Put the tool on your PATH once: & ([scriptblock]::Create((irm https://raw.githubusercontent.com/microsoft/winappCli/main/scripts/winapp-pr.ps1))) -AddToPathThen this build is just: winapp-pr 1066Run Updated 2026-10-13 00:08:22 UTC · commit |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 722ef99e-56b6-4428-976b-3761e371b3d4
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 722ef99e-56b6-4428-976b-3761e371b3d4

Description
Adds
samples/dotnet-file-appand a step-by-step guide for .NET 10 file-based apps: a single.csfile with no project file, manifest, or assets.winapp run app.csgives it package identity, generating the manifest and default assets in the build output. Because the sample referencesMicrosoft.Windows.SDK.BuildTools.WinApp, plaindotnet run app.csgives the same packaged launch.The sample includes:
#:propertyidentity and capabilities, or anapp.appxmanifestnext to the file).test.Tests.ps1. Phase 1 follows the guide from scratch: the new file printsNot packagedunderdotnet run, then gets identity withwinapp run. Phase 2 runs the sample withwinapp runand thendotnet run. The test unregisters both apps afterwards. It only unregisters the sample if the test registered it, so a developer's own registration survives a skipped run.test-samples.ymlmatrix and gets the run's NuGet packages, so@*-*resolves to the branch build. The hard-coded expectations inartifact-workflow.Tests.ps1are updated to match.The new guide,
docs/guides/dotnet-file-based.md, walks through:dotnet run.It also covers adding capabilities or a custom manifest, and links to
docs/usage.mdfor the full reference. It's linked from the root README,docs/README.md,llms.txt, the .NET guide, the sample README, and the MS Learn TOC inport-mslearn-docs.ps1.Usage Example
Related Issue
Fixes #1064
Related to #1065. The test and guide use an explicit
winapp unregisterinstead of--unregister-on-exit, which currently fails to clean up when not elevated.Type of Change
Checklist
Screenshots / Demo
N/A. Console sample; see the usage example above.
Additional Notes
Local validation on Windows ARM64 with .NET SDK 10.0.401, using a Debug build of the CLI on PATH:
samples\dotnet-file-app\test.Tests.ps1: 9/9 passed, and no registrations were left behind. The npm global install step was skipped locally; CI exercises it.scripts\tests\artifact-workflow.Tests.ps1: 25/25 passed.scripts\validate-mslearn-docs.ps1: passed.scripts\tests\validate-mslearn-docs.Tests.ps1: 37/37 passed.Unlike the other .NET samples, there is no
.gitignore: file-based builds go to%TEMP%\dotnet\runfile\, not the sample folder. There is also no MSIX packaging section; the guide points to the .NET guide for packaging.