Introduction to msbuild structured log viewer

Time:2020-10-19

Thanks to vatsan madhavan for recommending the msbuild output log visualization tool, which can preview the complex output of msbuild using the beautiful WPF interface

This is a fully open source tool. Please see kirillosenkov / msbuild structured log: a logger for msbuild that records a structured representation of executed targets, tasks, property and item values

The use of this tool is very simple. First, use the msbuild command in the project/blgeneratemsbuild.binlogFile, such as using the following code

msbuild /bl

Download the latest version from the official website msbuild log viewer

Open the software, and themsbuild.binlogDrag the file in to display the log information

In addition, the tool also provides nuget library, which can be used to read binlog files

Install first MSBuild.StructuredLogger Library, and then use the following code

using System;
using Microsoft.Build.Logging.StructuredLogger;

class BinaryLogReadBuild
{
    static void Main(string[] args)
    {
        string binLogFilePath = @"C:\temp\test.binlog";

        var buildRoot = BinaryLog.ReadBuild(binLogFilePath);
        buildRoot.VisitAllChildren(c => Console.WriteLine(c.CommandLineArguments));
    }
}

This software uses a particularly beautiful treeview, welcome to copy the style