dotnet/build-parallelism
Diagnose and fix under-parallelized MSBuild builds. USE WHEN a multi-project solution build is slower than expected, doesn't speed up when you add cores, pegs a single core while others idle, or you want to know why `-m` isn't helping. Note: `/maxcpucount` default is 1 (sequential) — always pass `-m` for parallel builds. Covers finding the critical path (longest serial ProjectReference chain), graph build (`/graph`), BuildInParallel, and solution filters (`.slnf`). DO NOT USE FOR: single-project builds, incremental issues (use incremental-build), compilation slowness inside one project (use build-perf-diagnostics), non-MSBuild build systems.
npx skills add https://github.com/dotnet/skills --skill build-parallelism
Work this checklist in order — it targets the usual root cause (a serial
dependency chain that no number of cores can parallelize):
dotnet build -m /bl:{}(PowerShell: dotnet build -m -bl:{{}}). -m with no number uses all logical
processors; without -m MSBuild runs a single node (sequential).
node timeline. If total build time ≈ the sum of the projects on one
dependency chain, that chain — not CPU count — is the bottleneck.
Core → Api → Web → Tests. A long serialchain stays serial no matter how large -m is, because each project waits on
its predecessor.
ProjectReference edges that lengthen the chain — areference that only needs build order (not the output assembly), or one that
could be a PackageReference, forces serialization it doesn't need.
build concurrently, and consider /graph for better scheduling.
/maxcpucount (or -m): number of worker nodes (processes)-m for parallel builds-m without a number = use all logical processorsperformancesummary and check Project Performance Summary — shows per-project time; grep for node.*assigned to check scheduling/graph)dotnet build /graph or msbuild /graph<ProjectReference> (no programmatic MSBuild task references)<ProjectReference> — each adds to the dependency chain<ProjectReference ... SkipGetTargetFrameworkProperties="true"> to avoid extra evaluations<ProjectReference ... ReferenceOutputAssembly="false"> for build-order-only dependenciessolution filters (.slnf) to build subsets of the solution<MSBuild Projects="@(ProjectsToBuild)" BuildInParallel="true" /> in custom targetsBuildInParallel="true", MSBuild task batches projects sequentially/maxcpucount > 1 for this to have effectIMultiThreadableTask can run on multiple threads[MSBuildMultiThreadableTask]Use the binlog MCP server (Microsoft.AITools.BinlogMcp, exposed under the binlog MCP namespace):
Step-by-step:
dotnet msbuild build.binlog -noconlog -fl -flp:v=diag;logfile=full.log;performancesummaryfull.loggrep 'Target Performance Summary' -A 30 full.log → find the bottleneck targets-m in CI (many CI runners have multiple cores)dotnet build /graph works well with structured CI pipelinesTake dotnet/build-parallelism from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.