Skip to content

[Breaking change]: some dotnet CLI commands will log verbose/non-command-relevant data to stderr instead of stdout #48081

@baronfel

Description

@baronfel

Description

Starting in .NET 10.0.100 RC2 with dotnet/sdk#50472, some dotnet CLI command output that is not 'core' to the command being invoked will be emitted to stderr instead of stdout. At time of this writing, the only change is the first-run message output, but this set will grow over time.

Version

.NET 10 RC 2

Previous behavior

First-run messages for the dotnet CLI emit to stdout

New behavior

First-run messages for the dotnet CLI emit to stderr

Type of breaking change

  • Binary incompatible: Existing binaries might encounter a breaking change in behavior, such as failure to load or execute, and if so, require recompilation.
  • Source incompatible: When recompiled using the new SDK or component or to target the new runtime, existing source code might require source changes to compile successfully.
  • Behavioral change: Existing binaries might behave differently at run time.

Reason for change

Writing information to stdout that isn't directly related to the command being invoked inhibits the use of commands in scripting or noninteractive circumstances. Moving to stderr emission for non-primary outputs like diagnostics, verbose messages, or incidental notifications means that stdout remains clean for parsing or other interpretation.

Recommended action

For most non-PowerShell users, this change shouldn't be a huge change. For PowerShell users, we recommend:

  • using at least PowerShell version 7.2, where redirecting to stderr doesn't set PowerShell's $Error variable and cause Powershell to think the previous command failed execution

Feature area

SDK

Affected APIs

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

🔖 Ready

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions