dotnet/eval-performance
Guide for diagnosing and improving MSBuild project evaluation performance. USE FOR: builds slow before any compilation starts, high evaluation time in binlog analysis, expensive glob patterns walking large directories (node_modules, .git, bin/obj), deep import chains (>20 levels), preprocessed output >10K lines indicating heavy evaluation, property functions with file I/O ($([System.IO.File]::ReadAllText(...))), multiple evaluations per project. Covers the 5 MSBuild evaluation phases, glob optimization via DefaultItemExcludes, import chain analysis with /pp preprocessing. DO NOT USE FOR: compilation-time slowness (use build-perf-diagnostics), incremental build issues (use incremental-build), non-MSBuild build systems.
npx skills add https://github.com/dotnet/skills --skill eval-performance
Evaluation is the work MSBuild does *before* any target runs — reading project
files, processing imports, expanding globs. This skill helps you **find and
confirm** evaluation bottlenecks. Measure first; recommend a change only when a
measurement proves it is warranted.
Engage only when evaluation is *measurably* the bottleneck. Do NOT act when:
That is not an evaluation problem — use build-perf-diagnostics instead.
incremental-build instead.
is slow, gather one first (see below). Do not guess from reading project files.
imports, or EnableDefaultItems are only worth flagging when the numbers show
they cost real time. A project that evaluates quickly needs no change.
When a pattern is present but unmeasured, **report it as an observation and let
the user decide** — do not rewrite working configuration to match a "best
practice" without evidence it costs measurable evaluation time. Prefer the
smallest, most targeted change; never disable SDK defaults as a first move.
For a comprehensive overview of MSBuild's evaluation and execution model, see Build process overview.
<Import>, evaluate <PropertyGroup> top-to-bottom<ItemDefinitionGroup> metadata defaults<ItemGroup> with Include, Remove, Update, glob expansionKey insight: evaluation happens BEFORE any targets run. Slow evaluation = slow build start even when nothing needs compiling.
Use the binlog MCP server (Microsoft.AITools.BinlogMcp, exposed under the binlog MCP namespace) to analyze evaluation performance:
dotnet msbuild build.binlog -noconlog -fl -flp:v=diag;logfile=full.loggrep -i 'Evaluation started\|Evaluation finished' full.logdotnet msbuild -pp:full.xml MyProject.csprojOnly pursue these remedies once a measurement shows item evaluation is slow and
the globs are the cause; a custom glob that isn't walking large trees is fine.
**/*.cs walk the entire directory treenode_modules/, .git/, bin/, obj/ — millions of files<DefaultItemExcludes> to exclude large directoriessrc//*.cs instead of /*.cs<EnableDefaultItems>false</EnableDefaultItems> only as a last resort (loses SDK defaults) — prefer the two options above first/pp output → search for <!-- Importing comments to see import treegrep 'Evaluation started.*ProjectName' full.log → if count > 1, check for differing global properties/graph)$([System.IO.File]::ReadAllText(...)) during evaluation — reads file on every evaluationdotnet msbuild -pp:full.xmlTake dotnet/eval-performance from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.