dotnet / sdk

Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
https://dot.net/core
MIT License
2.6k stars 1.03k forks source link

dotnet build /v:q is not as quiet as msbuild /v:q #10032

Open MarkKharitonov opened 5 years ago

MarkKharitonov commented 5 years ago

Steps to reproduce

dotnet build /v:q

Expected behavior

Only the msbuild logo is displayed

Actual behavior

Additional lines are displayed:

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:01.15

Environment data

.NET Core SDK (reflecting any global.json):
 Version:   2.1.502
 Commit:    c74ce8f29f

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.16299
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.1.502\

Host (useful for support):
  Version: 2.1.6
  Commit:  3f4f8eebd8

.NET Core SDKs installed:
  1.0.0-preview2-003131 [C:\Program Files\dotnet\sdk]
  2.1.4 [C:\Program Files\dotnet\sdk]
  2.1.403 [C:\Program Files\dotnet\sdk]
  2.1.500 [C:\Program Files\dotnet\sdk]
  2.1.502 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 1.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download
MarkKharitonov commented 5 years ago

Please, see https://stackoverflow.com/questions/54033254/msbuild-and-dotnet-load-different-versions-of-sdk-targets EDIT 3 for a sample build output.

peterhuene commented 5 years ago

I think this might be a MSBuild issue.

Distributed loggers appear to default to showing summary. We use a distributed logger for telemetry in the CLI. However, SetForwardingBasedOnVerbosity should probably calculate _showSummary based on the verbosity level (which is quiet in this case) instead of defaulting to true.

Ping @rainersigwald to comment.

Edit: the above is an uneducated guess and I'm fairly unfamiliar with the MSBuild source 😄

peterhuene commented 5 years ago

Red herring, as:

dotnet exec "c:\Program Files\dotnet\sdk\3.0.100-preview-009793\MSBuild.dll" -v:q "-distributedlogger:Microsoft.DotNet.Tools.MSBuild.MSBuildLogger,C:\Program Files\dotnet\sdk\3.0.100-preview-009793\dotnet.dll*Microsoft.DotNet.Tools.MSBuild.MSBuildForwardingLogger,C:\Program Files\dotnet\sdk\3.0.100-preview-009793\dotnet.dll"

Doesn't show the summary, so there must be something else causing it.

peterhuene commented 5 years ago

Sorry for the ping, @rainersigwald. It looks like the build command itself is forcing the summary:

https://github.com/dotnet/cli/blob/1bc19fc6a933de844328095b807453e01f99617d/src/dotnet/commands/dotnet-build/BuildCommand.cs#L40

Thus the fix is entirely on the CLI side.

theswanand commented 4 years ago

Hi @peterhuene,

Can you assign this issue to me. I can try this as my first issue.

livarcocc commented 4 years ago

@theswanand done! Thanks for the interest and the help!

theswanand commented 4 years ago

Hi, Can anyone advice me the project name to simulate/fix this issue. As documented in Readme, the code has been moved to dotnet/toolset. But I am unable to build it as well. So should I need to try dotnet/sdk or I am missing something over here.

memark commented 4 years ago

Is this issue still active?

MarkKharitonov commented 4 years ago

Just checked for 16.4.0+e901037fe - still there.

theswanand commented 4 years ago

Hi @livarcocc , I tried simulating this on .NET 5.0 preview version and got below output

F:\Repos\sdk\src\Microsoft.DotNet.MSBuildSdkResolver>dotnet build /v:q
Microsoft (R) Build Engine version 16.6.0-preview-20126-02+13cfe7fc5 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:04.06

So by

only the MSBUILD logo should be displayed

are we expecting the output to be like this:

F:\Repos\sdk\src\Microsoft.DotNet.MSBuildSdkResolver>dotnet build /v:q
Microsoft (R) Build Engine version 16.6.0-preview-20126-02+13cfe7fc5 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

Are my assumptions correct? I will start working on this.

0x1000000 commented 3 years ago

I confirm the issue is still there (.Net 5 Release) and it is pretty annoying :)

theswanand commented 3 years ago

Hi,

I can see this similar issue(https://github.com/dotnet/sdk/issues/7986) where it was closed by @rainersigwald with below comments.

https://github.com/dotnet/sdk/issues/7986#issuecomment-604959822

chamons commented 2 years ago

For those looking for a workaround, as noted in the comment from ^

-v:quiet -consoleLoggerParameters:NoSummary

is actually quiet.

vijaya-lakshmi-venkatraman commented 2 years ago

Hello, Is this still available?

baronfel commented 2 months ago

We should re-evaluate if this is even required anymore. Terminal Logger is the default, and it is actually quiet when -v:q is passed.

rolfbjarne commented 2 months ago

We should re-evaluate if this is even required anymore. Terminal Logger is the default, and it is actually quiet when -v:q is passed.

$ dotnet build /v:q test.csproj
Restore complete (0.0s)

Build succeeded in 0.0s

Workload updates are available. Run `dotnet workload list` for more information.

vs

$ dotnet build /v:q test.csproj --tl:off

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:00.05

Workload updates are available. Run `dotnet workload list` for more information.

so 3 fewer lines (5 vs 8 lines).

$ dotnet --version
9.0.100-preview.3.24153.2
baronfel commented 2 months ago

One of those lines (in both cases) comes from the SDK itself - I think you would need to set an environment variable to disable workload manifest update advertisements in that case.

baronfel commented 2 months ago

@rainersigwald seeing that console logger has a parameter for no summary, should TL learn one as well?

rainersigwald commented 2 months ago

Hm, or should it just be implied by a successful /v:q?