Agent skill
binlog-failure-analysis
Analyze MSBuild binary logs to diagnose build failures by replaying binlogs to searchable text logs. Only activate in MSBuild/.NET build context. USE FOR: build errors that are unclear from console output, diagnosing cascading failures across multi-project builds, tracing MSBuild target execution order, investigating common errors like CS0246 (type not found), MSB4019 (imported project not found), NU1605 (package downgrade), MSB3277 (version conflicts), and ResolveProjectReferences failures. Requires an existing .binlog file. DO NOT USE FOR: generating binlogs (use binlog-generation), build performance analysis (use build-perf-diagnostics), non-MSBuild build systems. INVOKES: dotnet msbuild binlog replay, grep, cat, head, tail for log analysis.
Install this agent skill to your Project
npx add-skill https://github.com/managedcode/dotnet-skills/tree/main/catalog/Tools/Official-DotNet-MSBuild/skills/binlog-failure-analysis
SKILL.md
Analyzing MSBuild Failures with Binary Logs
Use MSBuild's built-in binlog replay to convert binary logs into searchable text logs, then analyze with standard tools (grep, cat, head, tail, find).
Build Error Investigation (Primary Workflow)
Step 1: Replay the binlog to text logs
Replay produces multiple focused log files in one pass:
dotnet msbuild build.binlog -noconlog \
-fl -flp:v=diag;logfile=full.log;performancesummary \
-fl1 -flp1:errorsonly;logfile=errors.log \
-fl2 -flp2:warningsonly;logfile=warnings.log
PowerShell note: Use
-flp:"v=diag;logfile=full.log;performancesummary"(quoted semicolons).
Step 2: Read the errors
cat errors.log
This gives all errors with file paths, line numbers, error codes, and project context.
Step 3: Search for context around specific errors
# Find all occurrences of a specific error code with surrounding context
grep -n -B2 -A2 "CS0246" full.log
# Find which projects failed to compile
grep -i "CoreCompile.*FAILED\|Build FAILED\|error MSB" full.log
# Find project build order and results
grep "done building project\|Building with" full.log | head -50
Step 4: Detect cascading failures
Projects that never reached CoreCompile failed because a dependency failed, not their own code:
# List all projects that ran CoreCompile
grep 'Target "CoreCompile"' full.log | grep -oP 'project "[^"]*"'
# Compare against projects that had errors to identify cascading failures
grep "project.*FAILED" full.log
Step 5: Examine project files for root causes
# Read the .csproj of the failing project
cat path/to/Services/Services.csproj
# Check PackageReference and ProjectReference entries
grep -n "PackageReference\|ProjectReference" path/to/Services/Services.csproj
Write your diagnosis as soon as you have enough information. Do not over-investigate.
Additional Workflows
Performance Investigation
# The PerformanceSummary is at the end of full.log
tail -100 full.log # shows target/task timing summary
grep "Target Performance Summary\|Task Performance Summary" -A 50 full.log
Dependency/Evaluation Issues
# Check evaluation properties
grep -i "OutputPath\|IntermediateOutputPath\|TargetFramework" full.log | head -30
# Check item groups
grep "PackageReference\|ProjectReference" full.log | head -30
Replay reference
| Command | Purpose |
|---|---|
dotnet msbuild X.binlog -noconlog -fl -flp:v=diag;logfile=full.log;performancesummary |
Full diagnostic log with perf summary |
dotnet msbuild X.binlog -noconlog -fl -flp:errorsonly;logfile=errors.log |
Errors only |
dotnet msbuild X.binlog -noconlog -fl -flp:warningsonly;logfile=warnings.log |
Warnings only |
grep -n "PATTERN" full.log |
Search for patterns in the replayed log |
dotnet msbuild -pp:preprocessed.xml Proj.csproj |
Preprocess — inline all imports into one file |
Generating a binlog (only if none exists)
dotnet build /bl:build.binlog
Common error patterns
- CS0246 / "type not found" → Missing PackageReference — check the .csproj
- MSB4019 / "imported project not found" → SDK install or global.json issue
- NU1605 / "package downgrade" → Version conflict in package graph
- MSB3277 / "version conflicts" → Binding redirect or version alignment issue
- Project failed at ResolveProjectReferences → Cascading failure from a dependency
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
dotnet-project-setup
Create or reorganize .NET solutions with clean project boundaries, repeatable SDK settings, and a maintainable baseline for libraries, apps, tests, CI, and local development.
csharp-scripts
Run single-file C# programs as scripts (file-based apps) for quick experimentation, prototyping, and concept testing. Use when the user wants to write and execute a small C# program without creating a full project.
dotnet-pinvoke
Correctly call native (C/C++) libraries from .NET using P/Invoke and LibraryImport. Covers function signatures, string marshalling, memory lifetime, SafeHandle, and cross-platform patterns. USE FOR: writing new P/Invoke or LibraryImport declarations, reviewing or debugging existing native interop code, wrapping a C or C++ library for use in .NET, diagnosing crashes, memory leaks, or corruption at the managed/native boundary. DO NOT USE FOR: COM interop, C++/CLI mixed-mode assemblies, or pure managed code with no native dependencies.
nuget-trusted-publishing
Set up NuGet trusted publishing (OIDC) on a GitHub Actions repo — replaces long-lived API keys with short-lived tokens. USE FOR: trusted publishing, NuGet OIDC, keyless NuGet publish, migrate from NuGet API key, NuGet/login, secure NuGet publishing. DO NOT USE FOR: publishing to private feeds or Azure Artifacts (OIDC is nuget.org only). INVOKES: shell (powershell or bash), edit, create, ask_user for guided repo setup.
dotnet-legacy-aspnet
Maintain classic ASP.NET applications on .NET Framework, including Web Forms, older MVC, and legacy hosting patterns, while planning realistic modernization boundaries.
dotnet-code-review
Review .NET changes for bugs, regressions, architectural drift, missing tests, incorrect async or disposal behavior, and platform-specific pitfalls before you approve or merge them.
Didn't find tool you were looking for?