.NET build performance

.NET build performance for a slow compile.

.NET build performance is a narrower cut than the whole pipeline. I work on MSBuild optimization, the project graph, CopyLocal cascades and disk I/O — the machinery under dotnet build and a slow Visual Studio build. I am the MSBuild consultant for dotnet build optimization and for dotnet build speed. Runtime profiling of the application is not this page.

Start the conversation

Where the compile actually waits

I judge MSBuild performance by wall time, CPU work, disk I/O and the critical path. The binary log and the structured log are what I read.

  • MSBuild optimization: redundant CopyLocal cascades, and an incremental build that still repeats them.
  • The MSBuild project graph: what is on the critical path, and what only looks slow as wall time.
  • Disk I/O and artifacts. A clean build that writes a gigabyte of duplicates is not a compiler problem.
  • A slow Visual Studio build, including Visual Studio 2022, when one file change repeats the same copy.

Proof

A nopCommerce monorepo, measured

Forty-plus projects, modular plugins. I changed how MSBuild copies references. Wall time moved 93s to 88s. Under that:

  • CPU work: 307s → 202s (−34%).
  • Artifacts written: 1,101 MB → 109 MB (−90%).
  • Disk I/O phase: 16.8% → 0%.
  • Wall clock: 93s → 88s. Five seconds. Easy to misread.

The stopwatch was the wrong instrument. CPU work and the disk cascade were the story. I have not measured the test suite on that repo, and I will not invent a figure for a latency I did not time.

Read the measurement

If the wait is the queue, the flakes or the whole loop, start at CI/CD optimization.