Download MSBuild Structured Log Viewer

or, install from Chocolatey:

C:\> choco install msbuild-structured-log-viewer

or, install the Visual Studio 2017 Extension to investigate builds inside Visual Studio:

Project System Tools

Using MSBuild.exe /bl to record a binary log

MSBuild 15.3 introduces a new command-line switch: /bl to record all build events to a structured/binary log file:

Double-click the .binlog file to open it in MSBuild Structured Log Viewer:

Replaying a .binlog to reconstruct text logs

You can pass a .binlog file to MSBuild instead of a project/solution to replay it to other loggers, as if a real build was happening. This allows you to reconstruct a text log of any verbosity given the .binlog file. Read more at:

Binary log advantages

Read more about the new MSBuild binary log format (*.binlog)

Viewer Features

The MSBuild Structured Log Viewer can build projects and solutions or open existing log files:

Leverage the source code of projects and targets embedded in the log file:

The viewer supports three file formats:

  1. *.binlog (official MSBuild binary log format, produced by msbuild.exe /bl
  2. *.buildlog (when you Save As... in the viewer)
  3. *.xml (for large human-readable XML logs)

The viewer can read all 3 formats and can save to either *.buildlog or *.xml.

See here for the list of viewer features

Command-line help for the /bl switch

See MSBuild command-line help msbuild /? for more information on the /bl switch. The switch is available starting with MSBuild 15.3 (Visual Studio 2017 Update 3 or newer).

/binaryLogger[:[LogFile=]output.binlog[;ProjectImports={None,Embed,ZipFile}]] Serializes all build events to a compressed binary file. By default the file is in the current directory and named "msbuild.binlog". The binary log is a detailed description of the build process that can later be used to reconstruct text logs and used by other analysis tools. A binary log is usually 10-20x smaller than the most detailed text diagnostic-level log, but it contains more information. (Short form: /bl) The binary logger by default collects the source text of project files, including all imported projects and target files encountered during the build. The optional ProjectImports switch controls this behavior: ProjectImports=None - Don't collect the project imports. ProjectImports=Embed - Embed project imports in the log file. ProjectImports=ZipFile - Save project files to where output is the same name as the binary log file name. The default setting for ProjectImports is Embed. Note: the logger does not collect non-MSBuild source files such as .cs, .cpp etc. A .binlog file can be "played back" by passing it to msbuild.exe as an argument instead of a project/solution. Other loggers will receive the information contained in the log file as if the original build was happening. You can read more about the binary log and its usages at: Examples: /bl /bl:output.binlog /bl:output.binlog;ProjectImports=None /bl:output.binlog;ProjectImports=ZipFile /bl:..\..\custom.binlog /binaryLogger

Recording a binary log with older versions of MSBuild

The built-in /bl switch was only introduced in MSBuild 15.3 (Visual Studio 2017 Update 3). However there is a way to record a binary log with previous versions of MSBuild as well. You can attach the logger to any MSBuild-based build using the logger library: StructuredLogger.dll. It is available in a NuGet package:


Alternatively, you can download StructuredLogger.dll directly from the releases page at:

Use a command-line such as this to pass the BinaryLogger to MSBuild:

msbuild solution.sln /t:Rebuild /v:diag /noconlog /logger:BinaryLogger,%localappdata%\MSBuildStructuredLogViewer\app-1.2.19\StructuredLogger.dll;1.binlog

To use a portable version of the logger (e.g. with the dotnet msbuild command) you need a .NET Standard version of StructuredLogger.dll, not the .NET Framework (Desktop) version. Inside the NuGet package there is the lib\netstandard1.5\StructuredLogger.dll. Try passing that to dotnet build like this:

dotnet msbuild Some.sln /v:diag /nologo /logger:BinaryLogger,"packages\Microsoft.Build.Logging.StructuredLogger.1.2.19\lib\netstandard1.5\StructuredLogger.dll";"C:\Users\SomeUser\Desktop\binarylog.binlog"

Investigating IDE and design-time builds inside Visual Studio

Use the Project System Tools Visual Studio extension to record binary logs of IDE and design-time builds.

See more information about design-time builds here:

Reading MSBuild .binlogs programmatically

Reference the Microsoft.Build.Logging.StructuredLogger NuGet package and Microsoft.Build.Framework/15.6.85 and use this code to read the records from a .binlog:

using System; using Microsoft.Build.Framework; using Microsoft.Build.Logging; class BinLogReader { static void Main(string[] args) { string binLogFilePath = @"C:\temp\test.binlog"; var binLogReader = new BinaryLogReplayEventSource(); foreach (var record in binLogReader.ReadRecords(binLogFilePath)) { var buildEventArgs = record.Args; // print command lines of all tool tasks such as Csc if (buildEventArgs is TaskCommandLineEventArgs taskCommandLine) { Console.WriteLine(taskCommandLine.CommandLine); } } } }
Fork me on GitHub

Source code on GitHub

The MSBuild Structured Log Viewer project is open-source on GitHub at:

This webpage is also open-source at: