Skip to content

Make winapp run output as clean as dotnet build - #1037

Merged
Nikola Metulev (nmetulev) merged 36 commits into
mainfrom
nmetulev-winapp-run-quieter-output
Oct 13, 2026
Merged

Nikola Metulev (nmetulev) merged 36 commits into
mainfrom
nmetulev-winapp-run-quieter-output

Conversation

@nmetulev

@nmetulev Nikola Metulev (nmetulev) commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

Independent of #1032. The FluentStore output and recording below were captured with #1032 applied, because FluentStore only builds with that fix: on main alone it fails with APPX1101, before and after this PR. The output changes here apply either way.

Description

On an interactive terminal, winapp run <project> printed much more than dotnet build for the same build:

  • Every warning appeared twice, once inline and once in the summary. winapp let the build restore itself, so it had to stream the build through the classic logger (-tl:off) to redact authenticated NuGet feed URLs.
  • When a whole-solution restore failed (for example, a solution that lists projects from an uninitialized git submodule), winapp restored every listed project one at a time. Each one printed a banner, a long wrapped dotnet restore command and NuGet output, and the missing projects each failed with MSB1009.
  • The full injected dotnet command was printed for every step.

Now:

  • Interactive terminal: restore runs on its own, through winapp (feed credentials stay redacted), behind a spinner. It reports one line plus any warnings, once each. The build then runs with --no-restore and dotnet's terminal logger, so it looks exactly like dotnet build: one line per project, each warning once, one summary line.
  • Solutions: projects that aren't on disk are skipped with one note. The solution's other .NET projects restore in a single invocation through a temporary solution filter (.slnf) that lists only the projects winapp resolved to local files, so missing, native and UNC entries are left out. The solution itself is never handed to dotnet restore, so MSBuild can't open entries winapp skipped. A solution that lists .etp or %-escaped entries, which MSBuild would follow even through a filter, restores its projects one by one. winapp also retries project by project if the filtered restore fails for a reason other than a NuGet package error. A package error leaves the other projects restored, so retrying them would only repeat it.
  • Commands: full dotnet/MSBuild command lines appear only with --verbose, or after a step fails (Command: …) together with its full output. If the failed step was the solution-filter restore, winapp keeps the temporary .slnf so the printed command can be rerun.
  • Other modes:
    • Single-file (winapp run app.cs): behaves like a project on an interactive terminal. It restores through winapp with one summary line, then runs a --no-restore build with dotnet's terminal logger.
    • winapp pack and --aot: their restores use the same one-line summary on an interactive terminal. dotnet publish output still streams.
    • --no-restore: the build replays warnings from an earlier restore that winapp never saw, and those can quote a feed credential. So in both project and single-file mode it streams plain text through winapp's redaction.
    • C++: only the command display changed. A failure prints the exact MSBuild command.
    • Agents, CI and redirected output: still get plain streamed text.
    • --json and --quiet: --json keeps stdout pure JSON, with diagnostics and failed commands on stderr. --quiet stays quiet.
  • Redaction scope: dotnet gets the console only when nothing NuGet or winapp adds can quote a secret. That means a separate restore whose output needed no redaction, and no credential in the arguments. Otherwise the build streams through winapp's redaction. Text that a project's own targets choose to print appears as it would under dotnet build.

Usage Example

Observed in a real terminal, winapp run .\FluentStore.App --no-launch on FluentStore. FluentStore's .sln lists 4 projects from an uninitialized submodule. The warnings come from FluentStore itself and also appear in dotnet build. Long lines are trimmed with ….

Before (80 columns, incremental build):

🔎 FluentStore.App.csproj  ·  Debug | arm64  ·  FluentStore.sln
🔄 Restoring FluentStore.sln dependencies...
   dotnet restore D:\FluentStore\FluentStore.sln -p:Configuration=Debug
-p:SolutionDir=D:\FluentStore\ -p:SolutionPath=D:\FluentStore\FluentStore.sln
-p:SolutionName=FluentStore -p:SolutionFileName=FluentStore.sln
-p:SolutionExt=.sln
…NuGet.targets(521,5): error MSB3202: The project file "…\Cabinet.csproj" was not found. […]
   (×4)
⚠ Solution restore failed (exit code 1); retrying managed dependencies
individually.
🔄 Restoring Microsoft.Marketplace.Storefront.Contracts.csproj dependencies...
   dotnet restore
D:\FluentStore\API\MicrosoftStore\Microsoft.Marketplace.Storefront.Contracts.csp
roj -p:Configuration=Debug -p:Platform=arm64 -p:SolutionDir=D:\FluentStore\
…
  Determining projects to restore...
  All projects are up-to-date for restore.
   … the same block for every listed project, NU1901 repeated each time, and
     MSB1009 "Project file does not exist" for each submodule project …
🔧 Building FluentStore.App.csproj (Debug | arm64)...
   dotnet build D:\FluentStore\FluentStore.App\FluentStore.App.csproj -c Debug
-v minimal -tl:off -p:Platform=arm64 …
   … every warning inline (full length), then all of them again after "Build succeeded." …
    11 Warning(s)
    0 Error(s)
✅ Built FluentStore.App in 11.9s

After (109 columns):

🔎 FluentStore.App.csproj  ·  Debug | arm64  ·  FluentStore.sln
ℹ Skipping 4 projects listed in FluentStore.sln that aren't on disk
(API\UUPMediaCreator\src\Cabinet\Cabinet.csproj and 3 more).
✅ Restored FluentStore.App and 20 solution projects with 2 warning(s) in 3.7s
    D:\FluentStore\FluentStore.SDK\FluentStore.SDK.csproj : warning NU1901: Package 'NuGet.Packaging' 6.14.0 …
    D:\FluentStore\FluentStore.SDK\FluentStore.SDK.csproj : warning NU1901: Package 'NuGet.Protocol' 6.14.0 …
🔧 Building FluentStore.App.csproj (Debug | arm64)...
…Microsoft.UI.Xaml.Markup.Compiler.BeforeCommon.targets(31,3): warning MSB4011: … (×4, evaluation warnings, as in dotnet build)
  FluentStore.Services net8.0-windows10.0.22621.0 succeeded (0.1s) → …
  …
  FluentStore.SDK net8.0-windows10.0.22621.0 succeeded with 2 warning(s) (0.4s) → …
    …warning NU1901: … (×2)
  …
  FluentStore.App net8.0-windows10.0.22621.0 succeeded with 3 warning(s) …
    …warning NETSDK1198 / APPX0102 / APPX0107 …

Build succeeded with 9 warning(s) in 7.0s
✅ Built FluentStore.App in 7.2s
✅ 52374YoshiAskharoun.FluentStore_7sdtne7r32rbe registered (AUMID: …!App)

A failing step still shows everything needed to reproduce it. Here, the restore used a feed URL that carries a user name, password and sig= token, and all three are redacted:

…FailApp.csproj : error NU1301: Failed to retrieve information about 'Winapp.Does.Not.Exist' from remote source 'https://invalid.example/v3/index.json?<redacted>'.
  Failed to restore …\FailApp.csproj (in 2.45 sec).
   Command: dotnet restore …\FailApp.csproj -p:Configuration=Debug -p:Platform=arm64
-p:RestoreSources=https://invalid.example/v3/index.json?<redacted>
❌ Restore failed for 'FailApp.csproj' (exit code 1).

A build failure (-p WarningsAsErrors=NETSDK1198 on FluentStore) ends with Build failed with 1 error(s) and 8 warning(s), then Command: dotnet build … --no-restore … and ❌ Build failed for FluentStore.App.csproj (exit code 1).

Related Issue

Related to #1032: the FluentStore demo depends on it; the code doesn't.

Type of Change

  • 🐛 Bug fix
  • 🧪 Test update
  • 📝 Documentation

Checklist

  • New tests added for new functionality (if applicable)
  • Tested locally on Windows
  • docs/usage.md updated (if CLI commands changed)
  • Language-specific guides updated (if applicable)
  • Shipped skills updated in plugins/winapp/skills/ (if CLI commands/workflows changed)

Screenshots / Demo

Recording in Windows Terminal at 140×42, all three on an incremental FluentStore build (with #1032 applied), back to back: (1) dotnet build .\FluentStore.App -p:Platform=arm64 for reference, (2) winapp run .\FluentStore.App --no-launch without this PR, (3) the same command with this PR. Watch the live behavior, not only the final screen: (2) scrolls through the restore cascade and a classic-logger build, while (3) shows one restore spinner line, then the same live per-project progress as (1).

winapp-run-output-before-after.mp4

The final counts differ for a reason: dotnet build reports 11 warning(s) because its two restore warnings (NU1901) are counted in the build summary. This PR reports those two on the restore line and 9 warning(s) for the build; the build itself lists the same warnings in both.

Additional Notes

Validation (local, ARM64 dev box, unless noted). These ran on the earlier stacked branch, whose commits are the same apart from conflict resolutions in docs, the C++ build output and one sample assertion:

  • .\scripts\build-cli.ps1 -SkipTests -SkipDocs: passed.
  • .\scripts\test-samples.ps1 -Samples winui-app,winui-solution,winui-unpackaged-app,wpf-app,dotnet-app -WinappPath .\artifacts: 51/51 passed. Successful runs no longer print the build command, so the winui-app assertion that reads it now runs with --verbose.
  • Invoke-Pester .\tests\project-arch\ProjectArch.Tests.ps1: 46/46 passed.
  • CI on the stacked branch (Build and Package): all validate-tests shards, all four project-arch shards, docs and UI e2e passed (run).
  • Full WinApp.Cli.Tests (Debug): one unrelated failure, AnalyzeDumpAsync_ManagedDumpWithDeepStack_DetectsStackOverflowShape ("the .NET runtime in the dump does not match the host architecture (Arm64)").

After the rebase onto main:

  • dotnet run --project src\winapp-CLI\WinApp.Cli.Tests\WinApp.Cli.Tests.csproj -c Release -- --filter "FullyQualifiedName~ProjectRunService|FullyQualifiedName~RunCommand|FullyQualifiedName~PackageCommand": 878/878 passed.
  • A solution listing an irregularly formatted UNC entry ("Evil" , "\\localhost\nonexistent$\Evil.csproj"; Release CLI build, --verbose): winapp restores only through the .slnf and never runs dotnet restore App.sln; the entry never appears in the output, and the app builds.
  • A solution with a missing project and a sibling referencing a nonexistent package (published CLI): the solution-filter restore fails with NU1101. The .slnf named in the printed Command: line still exists after the failure, and rerunning that command reproduces NU1101.
  • FluentStore on main with this PR, in a real terminal: one restore line, then dotnet's terminal logger. The build then fails with APPX1101, the bug Fix winapp run/package building a referenced library twice (APPX1101/PRI252) #1032 fixes, followed by Command: dotnet build ….
  • PR CI (Build and Package, including samples and UI e2e) passed.

Project restores now pass -p:RuntimeIdentifier=<rid> alongside -r <rid>. dotnet restore -r only fills RuntimeIdentifiers, while dotnet build -r restores with RuntimeIdentifier set, so a RuntimeIdentifier-conditioned PackageReference was missing from the assets file a --no-restore build reads. For the same reason, the target always restores on its own rather than relying on a solution-scoped restore. Reproduced: restore -r win-arm64, then build -r win-arm64 --no-restore, fails with CS0103; with the property, it succeeds.

After the redaction and review follow-ups:

  • dotnet run --project src\winapp-CLI\WinApp.Cli.Tests\WinApp.Cli.Tests.csproj -c Release -- --filter "FullyQualifiedName~ProjectRunService|FullyQualifiedName~RunCommand|FullyQualifiedName~PackageCommand": 898/898 passed, and no winapp-restore-*.slnf files were left in %TEMP%.
  • Each new behavior test failed with its fix temporarily reverted: single-file redaction and separate restore, --json C++ and native MSIX Command: lines, and package preparation stopping on a solution package error.
  • With the .NET SDK 10.0.401 on a net10.0 project, --no-restore -f net8.0 fails with NETSDK1005 after an unpinned restore and builds after a restore pinned with -p:TargetFramework. A multi-targeting project also builds.
  • Real terminal: winapp run hello.cs --no-launch printed ✅ Restored hello in 0.8s, then dotnet's terminal logger (hello.cs net10.0 win-arm64 succeeded, Build succeeded in 0.5s).

@nmetulev Nikola Metulev (nmetulev) added the agent-preparing Agent is addressing feedback or completing required validation and CI label Oct 9, 2026
@nmetulev
Nikola Metulev (nmetulev) marked this pull request as draft October 9, 2026 03:23
@nmetulev Nikola Metulev (nmetulev) added ready-for-review Agent work and technical checks complete; awaiting review or re-review, not approval or merge and removed agent-preparing Agent is addressing feedback or completing required validation and CI labels Oct 9, 2026
On an interactive terminal, restore runs as its own redacted pass behind a
spinner and reports one line plus its warnings; the build then runs with
--no-restore so dotnet's terminal logger renders it. Solution siblings restore
in one invocation through a temporary solution filter that skips missing and
native projects. Full commands print only with --verbose or on failure.

Co-authored-by: Copilot App <[email protected]>
@nmetulev
Nikola Metulev (nmetulev) force-pushed the nmetulev-winapp-run-quieter-output branch from bd73700 to 928ef7e Compare October 9, 2026 04:46
@nmetulev
Nikola Metulev (nmetulev) changed the base branch from nmetulev-fluentstore-winapp-run-debug to main October 9, 2026 04:46
@nmetulev Nikola Metulev (nmetulev) added agent-preparing Agent is addressing feedback or completing required validation and CI and removed ready-for-review Agent work and technical checks complete; awaiting review or re-review, not approval or merge labels Oct 9, 2026
@nmetulev
Nikola Metulev (nmetulev) force-pushed the nmetulev-winapp-run-quieter-output branch from 928ef7e to b9099e7 Compare October 9, 2026 04:52
@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

⏳ Build in progress — metrics below are from a previous commit and will update when the current build finishes.

Build Metrics Report

Validation passed. All required build and validation jobs succeeded.

Binary Sizes

Artifact Baseline Current Delta
CLI (ARM64) 57.88 MB 57.97 MB 📈 +89.5 KB (+0.15%)
CLI (x64) 57.90 MB 57.98 MB 📈 +84.0 KB (+0.14%)
MSIX (ARM64) 24.05 MB 24.10 MB 📈 +48.8 KB (+0.20%)
MSIX (x64) 25.54 MB 25.56 MB 📈 +26.2 KB (+0.10%)
NPM Package 50.18 MB 50.25 MB 📈 +68.5 KB (+0.13%)
NuGet Package 50.29 MB 50.36 MB 📈 +74.3 KB (+0.14%)

.NET Test Results (TRX reports)

Other suites are reflected in the overall validation status above.

✅ 8413 passed, 37 skipped out of 8450 tests in 1318.7s (+37 tests, +258.8s vs. baseline)

Test Coverage

✅ 87.7% line coverage, 82.5% branch coverage · ✅ +0.1% vs. baseline

CLI Startup Time

64ms median (x64, winapp --version) · ✅ no change vs. baseline

Try This Build

Installs 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))) 1037
Switching between builds often?

Put the tool on your PATH once:

& ([scriptblock]::Create((irm https://raw.githubusercontent.com/microsoft/winappCli/main/scripts/winapp-pr.ps1))) -AddToPath

Then this build is just:

winapp-pr 1037

Run winapp-pr with no arguments to pick from a list of open PRs.


Updated 2026-10-13 02:45:46 UTC · commit b2a8943 · workflow run

@nmetulev Nikola Metulev (nmetulev) added ready-for-review Agent work and technical checks complete; awaiting review or re-review, not approval or merge agent-preparing Agent is addressing feedback or completing required validation and CI and removed agent-preparing Agent is addressing feedback or completing required validation and CI ready-for-review Agent work and technical checks complete; awaiting review or re-review, not approval or merge labels Oct 9, 2026
@nmetulev Nikola Metulev (nmetulev) added ready-for-review Agent work and technical checks complete; awaiting review or re-review, not approval or merge and removed agent-preparing Agent is addressing feedback or completing required validation and CI labels Oct 9, 2026
@nmetulev
Nikola Metulev (nmetulev) marked this pull request as ready for review October 9, 2026 07:35
Copilot AI balanced review requested due to automatic review settings October 9, 2026 07:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Rejected UNC or reparse-redirected solution entries can still reach whole-solution restore and expose Windows credentials.

1 open finding
What changed in this PR

Improves winapp run output and restore orchestration to match dotnet build while preserving credential redaction.

Changes:

  • Adds summarized interactive restores and cleaner command display.
  • Restores valid solution projects through temporary solution filters.
  • Expands tests and updates user-facing guidance.
File Description
ProjectRunService.SingleFile.cs Shows commands only for verbose or failed builds.
ProjectRunService.Restore.cs Adds restore orchestration and output handling.
ProjectRunService.NativeMsix.cs Cleans native packaging output.
ProjectRunService.Input.cs Plans solution restores and missing-project handling.
ProjectRunService.cs Integrates separate restore and terminal-logger flows.
ProjectRunService.Cpp.cs Cleans C++ command display.
ProjectRunService.Arguments.cs Aligns RID restore properties with builds.
ProjectRunServiceTests.cs Expands restore and output coverage.
ProjectRunServicePublishProfileTests.cs Tests filtered profile restores.
FakeDotNetService.cs Captures temporary solution filters.
samples/​winui-app/​test.Tests.ps1 Uses verbose output for command assertions.
plugins/​winapp/​skills/​winapp-setup/​SKILL.md Documents revised output behavior.
docs/​usage.md Documents restore, solution, and verbosity behavior.
docs/​guides/​dotnet.md Updates .NET workflow guidance.

🧠 Review effort: Balanced


💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Spectre wraps failure commands across physical lines, preventing them from being copied and rerun as promised.

0 open findings

2 resolved since last review
Previously missed (1)

In code that hasn't changed since last review

Medium severity Prevent failed commands from wrapping across physical output lines

src/​winapp-CLI/​WinApp.Cli/​Services/​ProjectRunService.Restore.cs:359

Failed commands are wrapped into invalid shell input. PrintFailedCommand renders through Spectre, which inserts physical newlines at the console width. For example, a failed run with a long temp path produced Command: dotnet build C:\...\0 followed by fb...\App.csproj on the next line; pasting that output into PowerShell does not rerun the command. This affects the new failure-command path in terminals and redirected/CI output. Write the command through the raw output writer (as restore diagnostics already do) so it remains one copyable line.

🧠 Review effort: Balanced

Spectre wrapped long commands at the console width, so the printed Command: line couldn't be pasted
back into a shell.

Co-authored-by: Copilot App <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The broad restore, redaction, and terminal-output changes need final human validation in a real interactive terminal despite passing 892 targeted Release tests.

0 open findings

🧠 Review effort: Balanced

@nmetulev Nikola Metulev (nmetulev) added ready-for-review Agent work and technical checks complete; awaiting review or re-review, not approval or merge and removed agent-preparing Agent is addressing feedback or completing required validation and CI labels Oct 10, 2026

@zateutsch Zach Teutsch (zateutsch) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 AI-generated review (winappcli pr-review skill) — verify before acting.

Thanks for the cleanup. The tests no longer leave .slnf files behind: 892/892 ProjectRunService/RunCommand/PackageCommand tests pass, with nothing left in %TEMP%.

One blocker from the new commits: the framework pin on the separate target restore breaks winapp run in a terminal when the app references a multi-targeted library (NETSDK1005). I reproduced it with the real binary in a console window. Details, a repro and a suggested fix are in the inline comment.

@nmetulev Nikola Metulev (nmetulev) added agent-preparing Agent is addressing feedback or completing required validation and CI and removed ready-for-review Agent work and technical checks complete; awaiting review or re-review, not approval or merge labels Oct 12, 2026
-p:TargetFramework is a global property, so it flowed to every ProjectReference and restored a
multi-targeted library (netstandard2.0;net8.0) only for the app's framework; the --no-restore build then
failed with NETSDK1005. dotnet build's own restore omits the framework too, and a framework the project
doesn't declare fails under plain dotnet build as well, so the pin fixed nothing.

Co-authored-by: Copilot App <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nmetulev Nikola Metulev (nmetulev) added ready-for-review Agent work and technical checks complete; awaiting review or re-review, not approval or merge and removed agent-preparing Agent is addressing feedback or completing required validation and CI labels Oct 12, 2026
@nmetulev
Nikola Metulev (nmetulev) requested a balanced review from Copilot October 12, 2026 22:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// can't redact authenticated NuGet source URLs. Restore separately (through winapp, which
// redacts them) so that build can run with --no-restore. A Native AOT publish restores its
// own publish graph, so a build-context target restore would be wasted there.
var separateTargetRestore = !publish && !aotPublish && UsesNativeTerminalBuild(options);
@nmetulev
Nikola Metulev (nmetulev) merged commit 7e118f6 into main Oct 13, 2026
36 checks passed
@nmetulev
Nikola Metulev (nmetulev) deleted the nmetulev-winapp-run-quieter-output branch October 13, 2026 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-review Agent work and technical checks complete; awaiting review or re-review, not approval or merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants