Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

No output to terminal if a malformed argument is provided #11372

Copy link
Copy link

Description

@martincostello
Issue body actions

Issue Description

If a mistake is made in passing arguments to dotnet msbuild, no output related to the error is printed to the terminal. I ran into this in an application where MSBuild is invoked as an external process via the Process class and the output is redirected to a stream to be consumed in the calling application.

The only way to get the actual reason for the failure appears to be via a binary log file with -bl.

Image

This makes diagnosing issues, particularly in CI environments, much more difficult to get to the bottom of than it should be.

Steps to Reproduce

  1. Open a terminal in a directory containing an MSBuild project/solution.
  2. Run a command such as the following where an argument is invalid: dotnet msbuild /t:Restore "/p:foo =bar" -v:diag

Expected Behavior

The error is printed to the terminal, in this case:

MSBUILD error MSB4177: Invalid property. The name "foo " contains an invalid character " ".

Actual Behavior

Only the command passed to MSBuild is rendered to the console

❯ dotnet msbuild /t:Restore "/p:foo =bar" -v:diag
C:\Program Files\dotnet\sdk\9.0.200-preview.0.24575.35\MSBuild.dll -distributedlogger:Microsoft.DotNet.Tools.MSBuild.MSBuildLogger,C:\Program Files\dotnet\sdk\9.0.200-preview.0.24575.35\dotnet.dll*Microsoft.DotNet.Tools.MSBuild.MSBuildForwardingLogger,C:\Program Files\dotnet\sdk\9.0.200-preview.0.24575.35\dotnet.dll -maxcpucount -tlp:default=auto -verbosity:m -v:diag /p:foo =bar /t:Restore .\DotNetOutdated.csproj

❯ $LASTEXITCODE
1

Analysis

No response

Versions & Configurations

  • dotnet --version: 9.0.200-preview.0.24575.35
  • dotnet msbuild --version: 17.13.0.56904
Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

Morty Proxy This is a proxified and sanitized view of the page, visit original site.