Developers working on large .NET solutions often build their projects several times during a single development session. They make a small code change, run a build, fix an issue, build again, and repeat the process throughout the day.
Even when the actual compilation takes only a few seconds, starting the build infrastructure repeatedly introduces additional overhead.
The .NET 11 SDK improves this experience by enabling the MSBuild Server by default for MSBuild-based .NET CLI commands.
Instead of starting a fresh build process for every command, the server keeps a process running between compatible builds. It retains useful build context so subsequent commands can avoid some of the startup and initialization work.
This is particularly useful for developers who frequently execute dotnet build and dotnet msbuild while working on local projects.
The improvement does not replace incremental compilation, parallel builds, or other MSBuild optimizations. It addresses a different part of the build process: the overhead of repeatedly starting and initializing MSBuild.
Let's understand how the MSBuild Server works, how .NET 11 enables it, and how developers can verify and troubleshoot its behavior.
Understanding the MSBuild Server
MSBuild is the build engine used by .NET projects. It evaluates project files, resolves dependencies, executes build targets, invokes compiler tasks, and produces application outputs.
When developers execute a command such as:
dotnet build
the .NET CLI starts the build process and invokes MSBuild.
Traditionally, repeated command-line builds could involve starting new MSBuild processes and repeating some initialization work.
The MSBuild Server changes this behavior.
It provides a long-running process that can accept build requests from subsequent CLI invocations. Instead of starting the entire build infrastructure from scratch every time, the CLI can communicate with an existing server.
The server preserves useful context between builds, reducing repeated startup and initialization costs.
For example, consider a developer working on a solution with several projects:
MyApplication.sln
|
+-- MyApplication.Api
|
+-- MyApplication.Services
|
+-- MyApplication.Data
|
+-- MyApplication.Models
|
+-- MyApplication.Tests
During development, the developer might execute:
dotnet build
dotnet test
dotnet build
With the MSBuild Server available, compatible build operations can reuse the existing server process rather than starting a completely new MSBuild environment for each invocation.
The server is especially useful when builds happen repeatedly within a short period.
What Changes in .NET 11?
The important change in .NET 11 is that the MSBuild Server is enabled by default for MSBuild-based .NET CLI commands.
In earlier .NET SDK versions, developers generally needed to enable the feature explicitly through an environment variable.
For example:
export DOTNET_CLI_USE_MSBUILD_SERVER=true
With the .NET 11 SDK, this additional configuration is no longer required for normal CLI builds.
The following commands can use the MSBuild Server automatically:
dotnet build
dotnet msbuild
The first compatible build starts the server if one is not already running.
Subsequent builds can reuse it while it remains available.
This makes the optimization part of the normal local development experience rather than something developers need to remember to configure.
It is important to distinguish the MSBuild Server from Visual Studio's existing build infrastructure. Visual Studio already hosts MSBuild and maintains build context within its own process. The MSBuild Server feature discussed here primarily benefits command-line builds through the .NET CLI.
How the MSBuild Server Reuses Build Context
The main benefit comes from keeping the server process alive between build requests.
A simplified execution flow looks like this:
First CLI Build
|
v
.NET CLI starts MSBuild Server
|
v
MSBuild evaluates projects
|
v
Build executes
|
v
Server remains available
|
v
Second CLI Build
|
v
.NET CLI connects to existing server
|
v
Cached context is reused
|
v
Build executes with less startup overhead
The server does not simply keep the complete output of the previous build and reuse it blindly.
MSBuild still evaluates the current build request, determines which targets need to execute, and checks whether projects or files require rebuilding.
The server primarily reduces the cost of repeatedly starting and initializing MSBuild.
This distinction matters because a warm MSBuild Server does not guarantee that every subsequent build will be fast.
For example, changing a shared project can still trigger compilation of several dependent projects. Restoring packages, running custom targets, or executing expensive generators can also take significant time.
The server reduces infrastructure overhead; it does not eliminate the work required by the build itself.
Trying the MSBuild Server With a .NET 11 Project
To understand the behavior, create a simple project using the .NET 11 SDK.
dotnet new console -n BuildServerDemo
cd BuildServerDemo
Check the installed SDK:
dotnet --version
Make sure the command uses a .NET 11 SDK.
Next, run the first build:
dotnet build
The first invocation may need to start the MSBuild Server and populate its cached context.
Run the same command again:
dotnet build
The second invocation can reuse the running server.
For a more realistic comparison, use a solution containing multiple projects and repeat the build after making small changes.
The benefit is generally more noticeable when developers execute many compatible build commands within a short development session.
A single build on a freshly started machine may not show a meaningful improvement because the server itself must first be started.
Understanding the Server's Lifetime
The MSBuild Server is designed to remain available after a build completes, but it does not need to run indefinitely.
By default, the server shuts down after 15 minutes of inactivity.
This behavior provides a balance between performance and resource usage.
For example:
A developer runs a build at 10:00 AM.
The build completes, but the server remains available.
Another build runs at 10:05 AM and can reuse the server.
The developer continues making changes and running builds.
If no compatible build request arrives for 15 minutes, the server shuts down.
The next build after that idle period may need to start a new server.
This is expected behavior, not an indication that the feature is broken.
The server is designed primarily for repeated development workflows rather than keeping a permanent background process running.
Checking Whether the MSBuild Server Is Running
Developers sometimes want to confirm whether a build actually uses the server.
The server can be identified through its process information.
On Windows, use PowerShell:
Get-CimInstance Win32_Process |
Where-Object {
$_.CommandLine -like "*MSBuild.dll*" -and
$_.CommandLine -like "*/nodemode:8*"
} |
Select-Object ProcessId, CommandLine
The /nodemode:8 argument identifies an MSBuild Server process.
On Linux or macOS, inspect the running processes:
ps -ef | grep MSBuild.dll
Look for the MSBuild server process and its /nodemode:8 argument.
There is an important distinction between the MSBuild Server and ordinary MSBuild worker nodes.
A process using /nodemode:1 represents a regular MSBuild worker node, while /nodemode:8 identifies the server node.
This distinction helps avoid confusing ordinary build processes with the long-running server.
Diagnosing Server Reuse With Diagnostic Logging
Finding the server process confirms that it exists, but it does not necessarily prove that a particular build reused it.
MSBuild provides diagnostic logging to investigate server behavior.
Run a build with diagnostic verbosity:
dotnet build -v:diag
The diagnostic output can provide information about whether the server was started, reused, or bypassed.
You can also capture a binary log:
dotnet build -bl:build.binlog
Open the generated binary log using MSBuild Structured Log Viewer.
The binary log contains detailed build information and server lifecycle events, making it useful when investigating unexpected startup behavior.
For example, if a developer expects a warm build but repeatedly sees a new server being started, diagnostic information can help identify why reuse is not happening.
This is particularly useful when working with custom build scripts, environment variables, and different SDK installations.
Disabling the MSBuild Server When Necessary
Although the MSBuild Server is enabled by default in .NET 11, there may be situations where developers want to disable it.
For example, a build environment may have specific process-management requirements, or a developer may want to compare builds with and without server reuse.
To disable the server for all builds using the CLI configuration environment variable, set:
On Windows PowerShell:
$env:DOTNET_CLI_USE_MSBUILD_SERVER = "false"
On Linux or macOS:
export DOTNET_CLI_USE_MSBUILD_SERVER=false
To enable it again, remove the variable or set it to true:
export DOTNET_CLI_USE_MSBUILD_SERVER=true
Another option is to disable node reuse for an individual build:
dotnet build -nr:false
The -nr:false option disables node reuse and, for a normal non-multithreaded build, prevents the MSBuild Server from being used.
The MSBuild Server is also explicitly managed through the build-server command.
To shut down running build servers:
dotnet build-server shutdown
This is useful when developers want to release resources, troubleshoot a build environment, or ensure that the next build starts with a fresh server process.
Shutting down the server does not remove project outputs or package caches. It only stops the relevant build-server processes.
Does the MSBuild Server Make Every Build Faster?
Not necessarily.
The MSBuild Server primarily reduces process startup and initialization overhead. Its benefits depend on how frequently builds are executed and how much time the application spends in that overhead.
Consider two scenarios.
Repeated local builds
A developer makes several small changes and executes dotnet build repeatedly.
This is a good use case because the server can remain active and reuse its cached context across compatible invocations.
One-time CI builds
A CI pipeline creates a fresh build environment, restores dependencies, builds the application, and then destroys the environment.
In this scenario, the server may provide limited benefits because there may not be enough subsequent builds to justify keeping it warm.
The same applies to short-lived build containers that are created and discarded after a single build.
However, CI environments that run several compatible builds within the same persistent worker may still benefit.
The important factor is whether the same build environment can reuse the server across multiple invocations.
Understanding the Difference Between MSBuild Server and Parallel Builds
The MSBuild Server and parallel build execution address different performance concerns.
The server reduces repeated startup and initialization overhead.
Parallel builds allow MSBuild to execute independent project work concurrently.
For example:
dotnet build -m
The -m option enables multiple MSBuild worker nodes so that independent projects can build in parallel.
The two capabilities should not be confused.
A solution can benefit from both a warm MSBuild Server and parallel project execution, depending on the build configuration.
.NET 11 also introduces a separate multithreaded build mode through the -mt option. This changes how MSBuild executes project work and is distinct from simply reusing the server between CLI commands.
When investigating build performance, measure these features separately before combining them.
Otherwise, it becomes difficult to identify which change actually improves the build.
Practical Recommendations for Development Teams
The MSBuild Server is most useful when developers repeatedly execute command-line builds during development.
A few practices can help teams get the expected benefit:
Use the .NET 11 SDK when working with the new default behavior.
Keep the same development environment active during repeated build operations.
Avoid shutting down the build server unnecessarily between compatible builds.
Use diagnostic verbosity or binary logs when server reuse does not behave as expected.
Compare warm and cold builds separately when measuring performance.
Do not assume that server reuse replaces incremental compilation or parallel execution.
Avoid expecting significant benefits from short-lived CI environments that run only one build.
For teams using VS Code, terminal-based workflows, local build scripts, or custom development tools, the default server behavior can reduce repetitive build overhead without requiring changes to application code.
Summary
The .NET 11 SDK enables the MSBuild Server by default for MSBuild-based .NET CLI commands such as dotnet build and dotnet msbuild.
Instead of starting a new build infrastructure for every compatible invocation, the CLI can reuse a long-running server process that retains useful build context between requests.
The server is particularly beneficial for local development workflows involving repeated builds. It remains available after a build and shuts down after 15 minutes of inactivity by default.
Developers can inspect server processes, use diagnostic logs to understand reuse behavior, disable the feature when necessary, or shut down the server using dotnet build-server shutdown.
The important point is that the MSBuild Server optimizes build startup and initialization overhead. It does not eliminate compilation, dependency restoration, or expensive custom build targets.
For developers who frequently build .NET solutions from the command line, this default behavior makes repeated development builds more efficient without requiring additional project configuration.
Join the conversation! Your thoughts help the community grow.