Analyze MSBuild binary logs to diagnose build failures.
MSBuild Server for CLI Caching
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).
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):
dotnet build-- server starts, no cache benefit - Second build (warm):
dotnet build-- should be noticeably faster
The most noticeable improvement is in repos with many projects or complex Directory.Build.props chains.
Related skills
Generate MSBuild binary logs (binlogs) for build diagnostics and analysis.
Guide for optimizing MSBuild build parallelism and multi-project scheduling.