dotnet / msbuild

The Microsoft Build Engine (MSBuild) is the build platform for .NET and Visual Studio.
https://docs.microsoft.com/visualstudio/msbuild/msbuild
MIT License
5.23k stars 1.35k forks source link

Detailed Build Summary with dotnet msbuild #4288

Closed ritchxu closed 5 years ago

ritchxu commented 5 years ago

Steps to reproduce

Build any project with dotnet msbuild -m -ds

Expected behavior

Detailed Build Summary like explained here should be output at the end. msbuild -tv:4.0 -m -ds output the summary as expected.

Actual behavior

No such report was output at the end of logs. Could not use dotnet msbuild -tv:4.0 -m -ds with error

MSBUILD : error MSB1040: ToolsVersion is not valid. The tools version "4.0" is unrecognized. Available tools versions are "15.0".

Environment data

msbuild /version output: 15.7.180.61344 dotnet msbuild /version output: 15.9.20.62856

OS info: Windows 10 Enterprise dotnet CLI version: 2.2.104

rainersigwald commented 5 years ago

Thanks for the report. This isn't quite a bug anywhere, but the default behavior of dotnet msbuild has changed quite a bit from the msbuild.exe behavior of that blog post.

What's changed?

To get the console summary

Add -verbosity:normal (or its short form -v:n) to the command line:

$ dotnet msbuild -ds -v:n
Microsoft (R) Build Engine version 16.0.443+g5775d0d6bb for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

Build started 4/5/2019 10:42:39 AM.
     1>Project "S:\repro\Microsoft\msbuild\issues\4288\4288.csproj" on node 1 (default targets).
     1>_CheckForNETCoreSdkIsPreview:
       C:\Program Files\dotnet\sdk\3.0.100-preview3-010431\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.RuntimeIdentifierInference.targets(151,5): message NETSDK1057: You are using a preview version of .NET Core. See: https://aka.ms/dotnet-core-preview [S:\repro\Microsoft\msbuild\issues\4288\4288.csproj]
       GenerateTargetFrameworkMonikerAttribute:
       Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
       CoreGenerateAssemblyInfo:
       Skipping target "CoreGenerateAssemblyInfo" because all output files are up-to-date with respect to the input files.
       CoreCompile:
       Skipping target "CoreCompile" because all output files are up-to-date with respect to the input files.
       GenerateBuildDependencyFile:
       Skipping target "GenerateBuildDependencyFile" because all output files are up-to-date with respect to the input files.
       CopyFilesToOutputDirectory:
         4288 -> S:\repro\Microsoft\msbuild\issues\4288\bin\x64\Debug\netstandard2.0\4288.dll
     1>Done Building Project "S:\repro\Microsoft\msbuild\issues\4288\4288.csproj" (default targets).
Deferred Messages

         Detailed Build Summary
         ======================

         ============================== Build Hierarchy (IDs represent configurations) =====================================================
         Id                  : Exclusive Time   Total Time   Path (Targets)
         -----------------------------------------------------------------------------------------------------------------------------------
         0                   : 0.755s           0.755s       S:\repro\Microsoft\msbuild\issues\4288\4288.csproj ()

         ============================== Node Utilization (IDs represent configurations) ====================================================
         Timestamp:            1        Duration   Cumulative
         -----------------------------------------------------------------------------------------------------------------------------------
         636900757592462532:   0        0.760s     0.760s ###############
         -----------------------------------------------------------------------------------------------------------------------------------
         Utilization:          100.0    Average Utilization: 100.0

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

Time Elapsed 00:00:00.81

File logger

You can also use a file logger to capture the detailed summary

$ dotnet msbuild -ds -fl
Microsoft (R) Build Engine version 16.0.443+g5775d0d6bb for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

C:\Program Files\dotnet\sdk\3.0.100-preview3-010431\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.RuntimeIdentifierInference.targets(151,5): message NETSDK1057: You are using a preview version of .NET Core. See: https://aka.ms/dotnet-core-preview [S:\repro\Microsoft\msbuild\issues\4288\4288.csproj]
  4288 -> S:\repro\Microsoft\msbuild\issues\4288\bin\x64\Debug\netstandard2.0\4288.dll

$ wsl tail -22 msbuild.log
     0>
Detailed Build Summary
======================

         ============================== Build Hierarchy (IDs represent configurations) =====================================================
         Id                  : Exclusive Time   Total Time   Path (Targets)
         -----------------------------------------------------------------------------------------------------------------------------------
         0                   : 0.754s           0.754s       S:\repro\Microsoft\msbuild\issues\4288\4288.csproj ()

         ============================== Node Utilization (IDs represent configurations) ====================================================
         Timestamp:            1        Duration   Cumulative
         -----------------------------------------------------------------------------------------------------------------------------------
         636900761511646132:   0        0.759s     0.759s ###############
         -----------------------------------------------------------------------------------------------------------------------------------
         Utilization:          100.0    Average Utilization: 100.0

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

Time Elapsed 00:00:00.81
ritchxu commented 5 years ago

Excellent, thanks @rainersigwald !