Repository navigation
Honor -p Configuration for .NET projects in run and package - #1282
Jaylyn Barbee (Jaylyn-Barbee) merged 5 commits into
Conversation
winapp run . -p:Configuration=Release built Debug for a .csproj because the -c default always won and the user's property was dropped. Use the C++ rule for every project type: -p Configuration selects the configuration unless -c was typed, and a -c/-p Configuration conflict is an error. Fixes #1278 Co-authored-by: Copilot App <[email protected]>
winapp run . -p:Configuration=Release on a folder or solution picked the runnable project under Debug, so an app that is only runnable in Release was not found. Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the configuration-resolution changes.
No open issues 🎉
What changed in this PR
Fixes #1278 so winapp run . -p:Configuration=Release builds Release instead of silently using Debug for .NET projects. Configuration selection now follows the same rules across .NET and C++ run and package modes.
Changes:
- Shares configuration resolution across project, single-file, and package modes, rejecting conflicting explicit
-cand-p Configurationvalues. - Uses the resolved configuration when selecting runnable projects from folders or solutions.
- Adds regression tests and updates command help and usage documentation.
| File | Description |
|---|---|
src/winapp-CLI/WinApp.Cli/Services/ProjectRunService.cs |
Removes the obsolete configuration-override diagnostic. |
src/winapp-CLI/WinApp.Cli/Services/ProjectRunService.Cpp.cs |
Removes the C++-specific configuration helper. |
src/winapp-CLI/WinApp.Cli/Services/ProjectRunService.Arguments.cs |
Adds shared configuration resolution and conflict detection. |
src/winapp-CLI/WinApp.Cli/Commands/RunCommand.SingleFileMode.cs |
Resolves configuration before single-file builds. |
src/winapp-CLI/WinApp.Cli/Commands/RunCommand.ProjectMode.cs |
Applies configuration resolution to builds and project selection. |
src/winapp-CLI/WinApp.Cli/Commands/PackageCommand.ProjectMode.cs |
Honors configuration properties for .NET packaging. |
src/winapp-CLI/WinApp.Cli/Commands/PackageCommand.cs |
Updates property-option help text. |
src/winapp-CLI/WinApp.Cli/Commands/PackageCommand.CppMode.cs |
Uses shared resolution for C++ packaging. |
src/winapp-CLI/WinApp.Cli.Tests/RunCommandSingleFileModeTests.cs |
Tests single-file configuration selection and conflicts. |
src/winapp-CLI/WinApp.Cli.Tests/RunCommandProjectModeTests.cs |
Tests .NET configuration selection, classification inputs, and conflicts. |
src/winapp-CLI/WinApp.Cli.Tests/ProjectRunServiceCppTests.cs |
Updates tests to reference the shared helper. |
src/winapp-CLI/WinApp.Cli.Tests/PackageCommandProjectModeTests.cs |
Tests packaging configuration selection and conflicts. |
docs/usage.md |
Documents configuration selection and conflict rules. |
Review effort: Balanced
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. ✅ 11029 passed, 44 skipped out of 11073 tests in 1783.0s (+10 tests, -335.7s vs. baseline) Test Coverage✅ 87.6% line coverage, 81.7% branch coverage · ✅ no change vs. baseline CLI Startup Time76ms 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))) 1282Switching 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 1282Run Updated 2026-11-05 03:43:51 UTC · commit |
|
One feedback point: Honor the same configuration when unregistering a single-file appWhat is wrong: Show me: Put this in XML Then run: PowerShell The last command returned exit code 0 and removed Debug: JSON Expected: remove Release and leave Debug alone. Release remained registered until I explicitly used Why it matters: Repeating the run’s configuration property can remove another configuration’s registration and potentially its app data. If Debug isn’t installed, cleanup silently leaves Release installed instead. Smallest fix: Use Location: [RunCommand.SingleFileMode.cs:87–91]( ), with the missing resolution in [UnregisterCommand.cs:284–288](winappCli/src/winapp-CLI/WinApp.Cli/Commands/UnregisterCommand.cs Lines 284 to 288 in 2d2b3ea |
Co-authored-by: Copilot App <[email protected]>
…-run-configuration-release
|
Fixed in ac3d87e: |
Brings in #1282 (honor -p Configuration for .NET projects in run and package). No conflicts; run --watch uses the resolved configuration through buildOptions. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 8d8406de-5d70-4aab-b23d-4742bc2baa12
What and why
winapp run . -p:Configuration=Releaseon a .NET project built and ran Debug, with no message unless you added-v.-cdefaults toDebug, and that default replaced your-p Configuration. C++ projects already handled this correctly.Now
-p Configuration=<name>picks the configuration for .NET projects too, unless you also type-c. If you type both with different values, winapp stops and tells you to pass only one. This applies to:winapp runon a project, a folder, a solution, or a single.csfilewinapp packageon a.csprojor.vcxprojwinapp unregisteron a single.csfile, so it removes the configuration thatrunregisteredWhen a folder or solution holds several projects, winapp now also uses
-p Configurationto decide which one is runnable.Fixes #1278
Before / after
Same command,
winapp run . -p:Configuration=Release, on a new console app.Before (main): builds
bin\DebugAfter (this branch): builds
bin\Release. Passing a different-cis rejected.Not tested / risks
winapp package. I checked thatpackage App.csproj -p:Configuration=Debugbuilds Debug (the package default is Release), and that a conflicting-cis rejected.-c X -p:Configuration=Ywith different values used to buildXwith no message. Now they fail with a clear error. The C++ path already did this.Checklist
plugins/winapp/skills/updated if user-facing behavior changedNotes for reviewers
The issue suggested a warning when
-cand-p Configurationdisagree. I made it an error instead, matching the existing C++ behavior, because a warning would still build the configuration you didn't want. The C++-only helper became a sharedTryResolveConfigurationused by every mode.Validation: affected test classes pass (690 run/package/project-run tests, Release build). I also checked each mode above with a published Release CLI: a single project, a folder where the app is runnable only in Release, a single
.csfile,package, and--jsonerror output.