Skip to content

dotnet run writes the "Using launch settings from ..." message to stdout instead of stderr #45640

Open
@Aethon

Description

@Aethon

Describe the bug

[On a Mac M1 using .NET 9.]
When using dotnet run to run a project that uses a launchSettings.json file, it writes a startup message like "Using launch settings from {filename}..." to stdout. Other run messages are written (correctly) to stderr. Because the message is written to stdout, it mixes in with the expect output of the program, often making it unparseable.

To Reproduce

  1. Clone this simple console project example: https://github.com/Aethon/DotNetOutputExample.
  2. Execute dotnet run > output.json.
  3. Examine output.json and note that it is not valid JSON due to the message at the top.

Further technical details

The errant line of code is here: https://github.com/dotnet/sdk/blob/main/src/Cli/dotnet/commands/dotnet-run/RunCommand.cs#L135.

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueIssues that would be a good fit for someone new to the repository. Narrow in scope, well-defined.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions