.NET 11 MSBuild Server: Diagnose Slow Local and CI Builds

The .NET 11 SDK keeps an MSBuild server warm between command-line invocations. That can reduce repeated startup work during local development. In CI, where a job often starts on a clean runner and exits after one build, measure the complete job before assuming the same benefit.

What is the MSBuild server?

The server is a process that can handle multiple MSBuild invocations. A new process launch and tool initialization can add overhead even when the source files have barely changed. A warm server can avoid part of that repeated work. Incremental build checks are a separate mechanism. They decide whether particular targets need to run based on inputs and outputs.

The Native AOT host for the dotnet CLI is also separate. The host can handle certain commands without starting the managed CLI. An application built using the SDK still uses its configured deployment model. The Microsoft release announcement describes both SDK changes.

Pin SDK and restore dependencies. Collect comparable build logs. Separate reuse from incremental work. Check full CI job time.
Pin SDK and restore dependencies. Collect comparable build logs. Separate reuse from incremental work. Check full CI job time.

Compare two consecutive builds

Use a project you can already restore and build. Close unrelated builds first if you want to compare timings. From the project directory, verify which SDK global.json selects.

BASH
dotnet --version
dotnet restore
dotnet build-server shutdown
dotnet build --no-restore -bl:first.binlog
dotnet build --no-restore -bl:second.binlog

Run a separate comparison with build-server reuse disabled.

BASH
dotnet build --no-restore --disable-build-servers -bl:no-servers.binlog

This is a diagnostic experiment. A first build can also warm filesystem caches and produce incremental outputs. To isolate the server as much as possible, use the same SDK, dependency graph, build properties and source state for each set. Run several sets in alternating order. For an incremental comparison, prebuild both cases before measuring them. For a clean-build comparison, use equivalent clean working copies and account separately for restoring dependencies.

Where to look when a build is slow

Observation Next check
Slow before compilation starts SDK selection, process startup, evaluation, networked filesystem
Slow only on a fresh runner Restore and setup phases, package cache policy, runner hardware
A tiny edit triggers a full build Target inputs and outputs, generated files, project references
Local build seems stuck Other processes, file locks, and whether an isolated invocation reproduces it

Review the binary log by phase. Look for long project evaluation, a generator or compiler taking most of the time, or targets running when the inputs did not change. A fast CLI launch will have little effect on a build dominated by a slow generator.

Binary logs may capture properties, paths and environment information. Keep them private until they have been reviewed. Use fresh output files for each measured run so the evidence remains comparable.

Decide what belongs in CI

Keep your CI SDK pinned and record the selected version in job logs. Use your normal package cache and restore policy. If a runner runs several builds in one job, compare the full job time and validate that logs and artifacts are equivalent. An ephemeral runner that performs one build can still benefit from other SDK improvements, but your data should determine whether server reuse matters for that job.

Use shutdown for an isolated diagnostic when you control the environment. On a shared developer machine, coordinate it with other builds. If a build still fails with servers disabled, investigate the project or environment instead of repeatedly restarting build processes.

FAQ

Does a warm server skip compilation? Incremental target checks decide whether a compile can be skipped. A warm server can reduce overhead around invoking the build.

Is a binary log a benchmark? It can help attribute elapsed time. A benchmark also needs comparable input, repeated observations, and a stated environment.

What if the second build is only a little faster? Inspect where the time goes. Tests, generators, dependency restore, or disk access may dominate your workflow.

For deployment-side comparisons, see the ASP.NET PB IIS deployment guide. Command references are available for dotnet build and dotnet build-server.

Comments