感谢 Vatsan Madhavan 小伙伴推荐的 MSBuild 输出日志可视化工具,这个工具可使用漂亮的 WPF 界面预览 MSBuild 复杂的输出内容git
这是一个彻底开源的工具,请看 KirillOsenkov/MSBuildStructuredLog: A logger for MSBuild that records a structured representation of executed targets, tasks, property and item values.github
这个工具的使用方法很简单,首先是在项目里面使用 MSBuild 命令加上 /bl
生成 msbuild.binlog
文件,如使用下面代码工具
msbuild /bl
从官网 MSBuild Log Viewer 下载最新版本ui
打开软件,将 msbuild.binlog
文件拖进去就能够显示日志的信息日志
另外这个工具还提供了 NuGet 库能够用来读取 binlog 文件code
先安装 MSBuild.StructuredLogger 库,而后使用下面代码blog
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<CscTask>(c => Console.WriteLine(c.CommandLineArguments)); } }
这个软件用到了特别漂亮的 TreeView 欢迎小伙伴抄样式get