Exploring the MSBuild log using the binary log viewer

  • Gérald Barré

Following my previous post about ILRepack, some people asked me where the MSBuild property ReferencePathWithRefAssemblies comes from. Is there a documentation, or something to find properties like this one? The documentation of MSBuild is very useful to understand how it works and the key concepts. However, they cannot document all the properties because there are dependents of the kind of project you build and the targets that run. The solution to find properties is to look at the log of the build. The textual log is not very readable and very long. However since MSBuild 15.3, you can output a binary log that you can open with MSBuild Binary and Structured Log Viewer. Let's see how to generate a binary log and use the tool to find what you want.

#Generating a log using the command line

  1. Open the console with MSBuild in the path:

    Open developer prompt

  2. Run msbuild with /bl flag to generate the binary log:

    msbuild solution.sln /bl

It outputs a file named msbuild.binlog:

Generated log file

#Generating a log using Visual Studio

  1. Install the Visual Studio extension: Project System Tools

  2. Open the tool window under View > Other Windows > Build Logging

  3. Click the button Start logging builds

    Start logging builds

  4. Open the log

    Open Logs

#Viewing the log

Install MSBuild Binary and Structured Log Viewer, and then open the file in the tool.

The tool allows you to view the list of steps of the build with the input and output parameters of each target. You can also view the xml code of the project to view where the target is defined.

MSBuild Binary and Structured Log Viewer

You can also search for something in all the log


This tools allows you to understand MSBuild and find useful data to write your build script. It's a must have in your toolbox.

Do you have a question or a suggestion about this post? Contact me!

Follow me:
Enjoy this blog?Buy Me A Coffee