How to collect MSBuild binlogs from the command line

Collect a binlog for .NET and .NET Core projects

Build the solution with dotnet build and the -bl option:

dotnet build -bl:C:\logs\msbuild.binlog C:\source\solution\Solution.sln

Collect a binlog for .NET Framework projects

  1. Find the MSBuild.exe that comes with Visual Studio:
    "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -latest -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe

    The usual locations are C:\Program Files\Microsoft Visual Studio\18\<Edition>\MSBuild\Current\Bin\ for Visual Studio 2026 and C:\Program Files\Microsoft Visual Studio\2022\<Edition>\MSBuild\Current\Bin\ for Visual Studio 2022.

  2. Build the solution with the -bl option:
    "<path to MSBuild.exe>" -bl:C:\logs\msbuild.binlog C:\source\solution\Solution.sln

Before sharing the binlog

A binlog includes environment variables and the contents of project files. Review it before you share it.

7 out of 7 found this helpful

Please sign in to leave a comment.

Have more questions?

Submit a request