| name | binlog-generation |
| description | Generate MSBuild binary logs (binlogs) for build diagnostics and analysis. USE FOR: adding /bl:{} to any dotnet build, test, pack, publish, or restore command to capture a full build execution trace, prerequisite for binlog-failure-analysis and build-perf-diagnostics skills, enabling post-build investigation of errors or performance. Requires MSBuild 17.8+ / .NET 8 SDK+ for {} placeholder; PowerShell needs -bl:{{}}. DO NOT USE FOR: non-MSBuild build systems (npm, Maven, CMake), analyzing an existing binlog (use binlog-failure-analysis instead). |
| license | MIT |
Generate Binary Logs
Pass the /bl switch when running any MSBuild-based command. This is a non-negotiable requirement for all .NET builds.
Commands That Require /bl
You MUST add the /bl:{} flag to:
dotnet build
dotnet test
dotnet pack
dotnet publish
dotnet restore
msbuild or msbuild.exe
- Any other command that invokes MSBuild
Preferred: Use {} for Automatic Unique Names
Note: The {} placeholder requires MSBuild 17.8+ / .NET 8 SDK or later.
The {} placeholder in the binlog filename is replaced by MSBuild with a unique identifier, guaranteeing no two builds ever overwrite each other — without needing to track or check existing files.
dotnet build /bl:{}
dotnet test /bl:{}
dotnet build --configuration Release /bl:{}
PowerShell requires escaping the braces:
# PowerShell: escape { } as {{ }}
dotnet build -bl:{{}}
dotnet test -bl:{{}}
Why This Matters
- Unique names prevent overwrites - You can always go back and analyze previous builds
- Failure analysis - When a build fails, the binlog is already there for immediate analysis
- Comparison - You can compare builds before and after changes
- No re-running builds - You never need to re-run a failed build just to generate a binlog
Examples
dotnet build /bl:{}
dotnet test /bl:{}
dotnet build -bl:{{}}
dotnet test -bl:{{}}
dotnet build
dotnet test
dotnet build /bl
dotnet build /bl
When a Specific Filename Is Required
If the binlog filename needs to be known upfront (e.g., for CI artifact upload), or if {} is not available in the installed MSBuild version, pick a name that won't collide with existing files:
- Check for existing
*.binlog files in the directory
- Choose a name not already taken (e.g., by incrementing a counter from the highest existing number)
dotnet build /bl:4.binlog
Cleaning the Repository
When cleaning the repository with git clean, always exclude binlog files to preserve your build history:
git clean -fdx -e "*.binlog"
git clean -fdx
This is especially important when iterating on build fixes - you need the binlogs to analyze what changed between builds.