optimizing-msbuild-performance
Installation
SKILL.md
MSBuild Performance Guidelines
MSBuild evaluates and builds thousands of projects in enterprise solutions. Performance is an architectural concern, not an afterthought.
Guiding Principle
Profile before optimizing; measure, do not guess. Use BenchmarkDotNet, the evaluation profiler (/profileevaluation), or ETW traces to identify actual bottlenecks before optimizing.
See evaluation-profiling.md and General_perf_onepager.md for profiling tools.
Allocation Awareness on Hot Paths
The evaluation and execution engines process millions of operations per build. Unnecessary allocations cause GC pressure that compounds across large solutions.
Rules
- Avoid LINQ in hot paths.
Where,Select,Any,Firstall allocate enumerator objects and delegate closures. Useforeachloops instead.