-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Consolidate default verbosity of msbuild-based commands #50243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR consolidates the default verbosity setting for MSBuild-based commands to ensure consistent behavior across the dotnet CLI. The change addresses issue #50227 by centralizing the default verbosity configuration.
- Introduces a centralized
DefaultVerbosityconstant set toVerbosityOptions.m - Updates
VirtualProjectBuildingCommandto use the centralized default instead of hardcodedquietverbosity - Adds comprehensive tests to verify verbosity behavior for run, build, and compilation diagnostic scenarios
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/Cli/Microsoft.DotNet.Cli.Utils/MSBuildForwardingAppWithoutLogging.cs | Defines centralized DefaultVerbosity constant and updates class to be sealed |
| src/Cli/dotnet/Commands/Run/VirtualProjectBuildingCommand.cs | Updates to use centralized default verbosity instead of hardcoded quiet |
| src/Cli/Microsoft.DotNet.Cli.Utils/MSBuildArgs.cs | Minor cleanup removing unused using statement and empty XML doc return tag |
| test/dotnet.Tests/CommandTests/Run/RunFileTests.cs | Adds tests for verbosity behavior in run, build, and compilation diagnostic scenarios |
|
@RikkiGibson @333fred for reviews, thanks |
| private readonly List<string> _msbuildRequiredParameters = [ "-maxcpucount", "--verbosity:m" ]; | ||
| private readonly List<string> _msbuildRequiredParameters = ["-maxcpucount", $"--verbosity:{DefaultVerbosity}"]; | ||
|
|
||
| internal const VerbosityOptions DefaultVerbosity = VerbosityOptions.m; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: It might be good to put this const with the other consts above. In particular seeing it used in an initializer just before its definition causes me to do a double take, until I realize it is a const it feels like something may be wrong.
| .WithWorkingDirectory(testInstance.Path) | ||
| .Execute() | ||
| .Should().Pass() | ||
| // no additional build messages |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It feels like if no build message is expected then it would be good to verify that, for example, the stdout does not contain Program.dll.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HaveStdOut verifies the stdout is exactly as written (nothing more), plus there is NotHaveStdErr to check stderr as well, but I can add .And.NotHaveStdOutContaining("Program.dll") to be even more specific.
|
/backport to release/10.0.1xx |
|
Started backporting to release/10.0.1xx: https://github.com/dotnet/sdk/actions/runs/17297895713 |
|
@jjonescz backporting to "release/10.0.1xx" failed, the patch most likely resulted in conflicts: $ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch
Applying: Consolidate default verbosity of msbuild-based commands
Using index info to reconstruct a base tree...
M src/Cli/Microsoft.DotNet.Cli.Utils/MSBuildArgs.cs
M src/Cli/dotnet/Commands/Run/VirtualProjectBuildingCommand.cs
M test/dotnet.Tests/CommandTests/Run/RunFileTests.cs
Falling back to patching base and 3-way merge...
Auto-merging src/Cli/Microsoft.DotNet.Cli.Utils/MSBuildArgs.cs
Auto-merging src/Cli/dotnet/Commands/Run/VirtualProjectBuildingCommand.cs
CONFLICT (content): Merge conflict in src/Cli/dotnet/Commands/Run/VirtualProjectBuildingCommand.cs
Auto-merging test/dotnet.Tests/CommandTests/Run/RunFileTests.cs
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0001 Consolidate default verbosity of msbuild-based commands
Error: The process '/usr/bin/git' failed with exit code 128Please backport manually! |
Fixes the inconsistency described in #50227 (comment).