Generated banner for Binlog Generation
Generated logo for Binlog Generation

Binlog Generation

.NET (Microsoft)OfficialPublished by .NET (Microsoft)

  • Skill
  • Tool integration
  • Software development
  • MIT
  • No issues found

From the author

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 must quote the complete switch as '-bl:{}'. DO NOT USE FOR: non-MSBuild build systems (npm, Maven, CMake), analyzing an existing binlog (use binlog-failure-analysis instead), binlog MCP startup failures (use troubleshoot-binlog-mcp).
— the description by .NET (Microsoft)

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

This skill provides instructions on using the /bl switch with MSBuild-based commands to capture comprehensive build execution traces. By utilizing the {} placeholder, users can automatically generate unique binary logs for every build invocation, ensuring that diagnostic data is preserved for failure analysis and performance comparisons without manual file management.

What it does

  • Explains how to append the /bl:{} switch to dotnet build, test, pack, and publish commands.
  • Details the use of the {} placeholder for automatic, unique filename generation.
  • Provides specific syntax requirements for PowerShell users to ensure the switch is correctly interpreted.
  • Offers guidance on verifying the creation of binlog files after a build process.
  • Advises on how to manage binlog files during repository cleanup to preserve build history.

When to use it

  • Whenever you need to capture a full execution trace of an MSBuild-based build.
  • Before running failure analysis or performance diagnostics on a .NET project.
  • When you want to avoid overwriting previous build logs during iterative development.
  • When you need to compare build behavior across different configurations or code changes.

Advantages

  • Prevents log overwrites by generating unique filenames automatically.
  • Ensures diagnostic data is immediately available for analysis upon build failure.
  • Eliminates the need to re-run builds specifically to capture logs.
  • Facilitates easy comparison between different build runs.

Usage examples

“How do I generate a unique binlog for my dotnet build command?”
Use 'dotnet build /bl:{}' in your terminal. The {} placeholder will automatically generate a unique filename for the build trace.
“How do I use the binlog switch in PowerShell?”
In PowerShell, you must quote the switch to ensure it is passed correctly: 'dotnet build '-bl:{}''.

Install

  1. Download the skill as a ZIP:

    https://mp-staging.autogineer.com/agent-skills/dotnet/binlog-generation/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip binlog-generation.zip -d .agents/skills

Documentation by .NET (Microsoft)

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.

# Every invocation produces a distinct file automatically
dotnet build /bl:{}
dotnet test /bl:{}
dotnet build --configuration Release /bl:{}

PowerShell requires quoting the complete switch:

# Keep the literal {} placeholder in one argument
dotnet build '-bl:{}'
dotnet test '-bl:{}'

Why This Matters

  1. Unique names prevent overwrites - You can always go back and analyze previous builds

  2. Failure analysis - When a build fails, the binlog is already there for immediate analysis

  3. Comparison - You can compare builds before and after changes

  4. No re-running builds - You never need to re-run a failed build just to generate a binlog

Examples

# ✅ CORRECT - {} generates a unique name automatically (bash/cmd)
dotnet build /bl:{}
dotnet test /bl:{}

# ✅ CORRECT - quote the complete PowerShell argument
dotnet build '-bl:{}'
dotnet test '-bl:{}'

# ❌ WRONG - Missing /bl flag entirely
dotnet build
dotnet test

# ❌ WRONG - No filename (overwrites the same msbuild.binlog every time)
dotnet build /bl
dotnet build /bl

One build = one binlog

Add /bl:{} to every MSBuild invocation separately — never reuse a name and never rely on bare /bl:

  • Building several configurations, projects, or retrying a failed build? Each command still gets its own /bl:{} so the logs never overwrite each other.

dotnet build -c Debug   /bl:{}   # unique file
dotnet build -c Release /bl:{}   # another unique file

Verify the binlog exists

After the build, confirm a .binlog was actually produced before moving on to analysis — a build that fails before MSBuild starts (e.g. a bad argument) writes no binlog:

ls -1 *.binlog       # bash
dir /b *.binlog      # Windows cmd
Get-ChildItem *.binlog   # PowerShell

Note the resulting path so binlog-failure-analysis or build-perf-diagnostics can consume it.

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:

  1. Check for existing *.binlog files in the directory

  2. Choose a name not already taken (e.g., by incrementing a counter from the highest existing number)

# Example: directory contains 3.binlog — use 4.binlog
dotnet build /bl:4.binlog

Cleaning the Repository

When cleaning the repository with git clean, always exclude binlog files to preserve your build history:

# ✅ CORRECT - Exclude binlog files from cleaning
git clean -fdx -e "*.binlog"

# ❌ WRONG - This deletes binlog files (they're usually in .gitignore)
git clean -fdx

This is especially important when iterating on build fixes - you need the binlogs to analyze what changed between builds.

Files

Requirements and compatibility

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Needs: Needs a command-line tool

Security

No issues found by our static scan· No issues found

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Published by
.NET (Microsoft)
Publisher
.NET (Microsoft) (Official)
Source
dotnet/skills · plugins/dotnet-msbuild/skills/binlog-generation · commit 96c3d68
Licence
MIT License (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by .NET (Microsoft).

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download binlog-generation.zip