Skills msbuild-server
Guide for using MSBuild Server to improve CLI build performance. Only activate in MSBuild/.NET build context. Activate when developers report slow incremental builds from the command line, or when CLI builds are noticeably slower than IDE builds. Covers MSBUILDUSESERVER=1 environment variable for persistent server-based caching. Do not activate for IDE-based builds (Visual Studio already uses a long-lived process).
git clone https://github.com/dotnet/skills
T=$(mktemp -d) && git clone --depth=1 https://github.com/dotnet/skills "$T" && mkdir -p ~/.claude/skills && cp -r "$T/plugins/dotnet-msbuild/skills/msbuild-server" ~/.claude/skills/dotnet-skills-msbuild-server && rm -rf "$T"
plugins/dotnet-msbuild/skills/msbuild-server/SKILL.mdMSBuild Server for CLI Caching
Use the MSBuild Server to cache evaluation results across CLI builds, matching the performance advantage Visual Studio gets from its long-lived MSBuild process.
When to Use
- Small incremental builds from CLI (
) are slower than expecteddotnet build - Developers notice that VS builds are faster than CLI builds for the same project
- CI agents run many sequential builds of the same repo
When Not to Use
- IDE-based builds (Visual Studio already uses a long-lived MSBuild process)
- One-off builds where cold-start overhead is acceptable
- Build correctness issues are suspected (disable the server to isolate the problem)
Inputs
| Input | Required | Description |
|---|---|---|
| Shell context | No | The shell where the environment variable will be set (bash, PowerShell, or Windows persistent) |
Workflow
Step 1: Confirm CLI context
Verify the developer is building from the command line (
dotnet build), not from Visual Studio or another IDE. The MSBuild Server provides no benefit inside an IDE.
Step 2: Set the environment variable
# Bash / CI export MSBUILDUSESERVER=1 # PowerShell $env:MSBUILDUSESERVER = "1" # Windows (persistent) setx MSBUILDUSESERVER 1
Step 3: Validate improvement
Run two sequential builds of the same project and compare times:
- First build (cold):
-- server starts, no cache benefitdotnet build - Second build (warm):
-- should be noticeably fasterdotnet build
The most noticeable improvement is in repos with many projects or complex
Directory.Build.props chains.
Validation
-
is set in the shellMSBUILDUSESERVER=1 - Second sequential build is faster than the first
-
followed by a rebuild confirms the server restarts cleanlydotnet build-server shutdown
Common Pitfalls
| Pitfall | Solution |
|---|---|
| Expecting improvement in Visual Studio | VS already uses long-lived MSBuild nodes; the server adds no benefit |
| Build correctness issues after enabling | Run to reset; if issues persist, disable the server |
| Server process using unexpected memory | The server persists in background; shut down with when idle |