build-parallelism

Diagnoses and fixes under-parallelized MSBuild builds by analyzing dependency graphs and binlogs.

Updated Jul 12, 2026
One-click install
npx skills add https://github.com/Patrick-Rex/DotNetTechSamples --skill build-parallelism-patrick-rex
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: build-parallelism
Source: https://github.com/Patrick-Rex/DotNetTechSamples/tree/main/.agents/plugins/dotnet-msbuild/skills/build-parallelism
Command: npx skills add https://github.com/Patrick-Rex/DotNetTechSamples --skill build-parallelism-patrick-rex

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Multi-project .NET solution builds often stay slow even on many-core machines because MSBuild defaults to a single node and long serial ProjectReference chains cannot be parallelized. This Skill identifies why -m is not helping and pinpoints the critical path blocking parallel execution. ## Core Features & Use Cases - Critical Path Analysis: Reads binlog per-project timings to find the longest serial dependency chain (e.g., Core → Api → Web → Tests) that determines minimum build time. - Parallelism Configuration Guidance: Covers -m//maxcpucount, graph build mode (/graph), BuildInParallel, and multi-threaded tasks via IMultiThreadableTask. - Dependency Graph Optimization: Recommends flattening false ProjectReference edges, using ReferenceOutputAssembly="false", converting to PackageReference, and applying solution filters (.slnf). - Use Case: A CI build of a 40-project solution takes 12 minutes despite an 8-core runner. Use this Skill to replay the binlog, discover a 6-project serial chain dominates the timeline, and restructure references so independent projects build concurrently. ## Quick Start Ask the assistant to diagnose why your solution build is slow despite using multiple cores, and have it analyze the MSBuild binlog for the critical dependency path.

Frequently Asked Questions about build-parallelism

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I make MSBuild use multiple cores for parallel builds?

Pass -m (or /maxcpucount) to dotnet build or msbuild. The default is 1 node, meaning builds run sequentially without the flag. Using -m with no number uses all logical processors, with each node building one project at a time.

Why is my solution build still slow after adding -m?

A long serial ProjectReference chain limits parallelism regardless of core count, because each project waits on its predecessor. Capture a binlog with -bl and check whether total build time roughly equals the sum of project times on one dependency chain.

What is the critical path in an MSBuild dependency graph?

The critical path is the longest chain of dependent projects, and it determines the minimum possible build time. If project A depends on B, C, and D, and B takes 60 seconds while C and D take 5, B is the bottleneck.

When should I use dotnet build /graph mode?

Use /graph for large solutions and CI builds, where constructing the full dependency graph upfront improves scheduling and avoids redundant evaluations. Do not use it when projects dynamically discover references at build time instead of using ProjectReference.

How do I reduce unnecessary ProjectReference dependencies?

Set ReferenceOutputAssembly="false" for build-order-only references, SkipGetTargetFrameworkProperties="true" to avoid extra evaluations, and consider converting references to PackageReference when only a pre-built NuGet output is needed. Solution filters (.slnf) also let you build subsets.

When should I not use this build parallelism approach?

It does not apply to single-project builds, incremental build issues, or slow compilation inside one project, which need different diagnostics. It also does not cover non-MSBuild build systems.