Skip to content
Development
Skill

/build-perf-baseline

Establish MSBuild/.NET build performance baselines before optimizing. USE FOR: unranked slow builds; cold, warm, incremental or no-op measurements; before/after comparisons; CI output caching; static graph, artifacts output and dependency graph trimming. Start here before

From plugin
skills
5.8k106 skills20 agents

Claude Code

$ npx -y skills add dotnet/skills --skill build-perf-baseline --agent claude-code

SKILL.md

build-perf-baseline.SKILL.md
name: build-perf-baseline
description: "Establish MSBuild/.NET baselines before optimizing. USE FOR: unranked slow builds; cold/warm/incremental/no-op measurements; before/after comparisons; CI caching; static graph, artifacts output, dependency graph trimming. DO NOT USE FOR: measured bottlenecks (build-perf-diagnostics), known repeated restores (eliminate-redundant-restores), within-build duplicate calls (find-repeated-work-within-one-build), non-MSBuild builds."
license: MIT

Build Performance Baseline & Optimization

Overview

Before optimizing a build, you need a **baseline**. Without measurements, optimization is guesswork. This skill covers how to establish baselines and apply systematic optimization techniques.

**Related skills:**

  • `build-perf-diagnostics` — binlog-based bottleneck identification
  • `incremental-build` — Inputs/Outputs and up-to-date checks
  • `build-parallelism` — parallel and graph build tuning
  • `eval-performance` — glob and import chain optimization

---

Step 1: Establish a Performance Baseline

Measure three scenarios to understand where time is spent. Keep the SDK, configuration, machine, environment variables, restore state, and build command consistent. Run each scenario at least three times, repeating its setup before every measured sample, and report the median plus the observed range; a single timing is not a baseline. Keep setup outside the timed interval. Save each sample's binlog under a unique name, outside generated output directories.

Cold Build (First Build)

No previous build output exists. Measures the full end-to-end time including restore, compilation, and all targets.

Before **every cold sample**, restore the same source state, run `dotnet clean` with the measured configuration, and remove only the confirmed, disposable output and intermediate directories for the measured projects. Include custom artifact paths, not just `bin` and `obj`, and obtain approval before deletion. Verify those outputs are absent before timing the next build.

This is an **output-cold** build, not necessarily a cold NuGet, OS, or compiler server cache. Choose and record a consistent cache/server policy for all samples; do not clear shared caches. If measuring uncached restore, use a separate, empty package cache for each sample.

# After repeating the cold setup; use a unique log name for each sample
dotnet build /bl:cold-build-1.binlog -m

Warm Build (Incremental Build)

Build output exists, some files have changed. Measures how well incremental build works.

Before **every warm sample**, restore the same baseline source contents and build successfully without timing it. Then apply the same small, build-relevant edit to the same source file and time the build. Keep the changed file set and edit identical across samples; do not let edits accumulate. Restore the baseline contents before the next sample and rebuild them outside the timed interval. Do not clean between that setup build and its measured build.

# Untimed setup after restoring baseline source contents
dotnet build -m

# Apply the same controlled source edit, then measure with a unique log name
dotnet build /bl:warm-build-1.binlog -m

No-Op Build (Nothing Changed)

Build output exists, nothing has changed. Compilation and correctly incremental targets should skip; compare timing with this build's other samples.

Before **every no-op sample**, restore the same baseline source contents and run an untimed setup build successfully. Then measure an identical build without edits, touching inputs, cleaning outputs, or changing properties. Keep restore and cache/server policy consistent with the other samples.

# Untimed setup after restoring baseline source contents
dotnet build -m

# Rebuild immediately without changes; use a unique log name for each sample
dotnet build /bl:noop-build-1.binlog -m

What Good Looks Like

| Scenario | Expected Behavior | |----------|------------------| | Cold build | Full compilation, all targets run. This is your absolute baseline | | Warm build | Only changed projects recompile. Time proportional to change scope | | No-op build | Compilation and correctly incremental custom targets skip; compare duration with this repo's repeated warm and cold samples |

**Red flags:**

  • No-op time is repeatedly close to warm/cold time, or compilation targets rerun → investigate incrementality (see `incremental-build`)
  • Warm build recompiles everything → project dependency chain forces full rebuild
  • Restore dominates cold samples → measure `dotnet restore` and `dotnet build --no-restore` separately before changing project structure

Do not use universal duration or percentage thresholds to declare a bottleneck. Rank costs against the controlled samples and the build's own target/task timings.

Capture analyzer evidence

A binlog shows compiler/task timing, but granular analyzer timing requires an analyzer-reporting run. When supported by the SDK/compiler, capture:

dotnet build /bl:analyzers.binlog /p:ReportAnalyzer=true

Open the binlog in MSBuild Structured Log Viewer and inspect the analyzer summary under the compiler task. If granular timing is unavailable, compare otherwise identical samples with `/p:RunAnalyzers=false` as an attribution experiment; do not present disabling analyzers as the fix. Preserve analyzer enforcement in CI.

Recording Baselines

Record baselines in a structured way before and after optimization:

| Scenario    | Before  | After   | Improvement |
|-------------|---------|---------|-------------|
| Cold build  | 2m 15s  |         |             |
| Warm build  | 1m 40s  |         |             |
| No-op build | 45s     |         |             |

---

Step 2: Artifacts Output Layout

The `UseArtifactsOutput` feature (introduced in .NET 8) changes the output directory structure to avoid bin/obj clash issues and enable better caching.

Enabling Artifacts Output

Read more
@dotnet
Ships withskills

This repository contains the .NET team's curated set of portable skills and host-specific custom agents for coding agents. For information about the Agent Skills standard, see agentskills.io.

5.8k106 skills20 agents
Get the whole plugin

Stars on GitHub

Momentum

stars in total
5.8k
Star history of dotnet/skills on GitHub, a chart by star-history.com

Other skills on skills.

csharp-scripts

csharp-scripts

Run file-based C# apps with the .NET CLI when the user explicitly wants C#/.NET code without creating a project. Use for C#…

@dotnet@dotnetInstall Skill
dotnet-pinvoke

dotnet-pinvoke

Correctly call native (C/C++) libraries from .NET using P/Invoke and LibraryImport. Covers function signatures, string…

@dotnet@dotnetInstall Skill
nuget-trusted-publishing

nuget-trusted-publishi…

Set up NuGet trusted publishing (OIDC) on a GitHub Actions repo — replaces long-lived API keys with short-lived tokens. USE FOR:…

@dotnet@dotnetInstall Skill
vectorization

vectorization

Design, implement, optimize, and review SIMD code in .NET. USE FOR: vectorizing scalar loops with TensorPrimitives,…

@dotnet@dotnetInstall Skill
technology-selection

technology-selection

Guides technology selection and implementation of AI and ML features in .NET 8+ applications using ML.NET,…

@dotnet@dotnetInstall Skill

More skills from other plugins.

brainstorming
Auto-invoked

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…

@obra@obraInstall Skill
ask-matt

ask-matt

Ask which skill or flow fits your situation. A router over the skills in this repo.

skills2w309k
@mattpocock@mattpocockInstall Skill
accessibility
Auto-invoked

accessibility

Design, implement, and audit accessible UI to WCAG 2.2 Level AA across Web, iOS, and Android — semantic ARIA roles and labels,…

ecc2w293k
@affaan-m@affaan-mInstall Skill
compiler-commit

compiler-commit

Use when you want to verify compiler changes and commit with the correct convention. Runs tests, lint, and format, then commits…

react5d252k
@facebook@facebookInstall Skill

Questions about build-perf-baseline.

Which coding agents can use build-perf-baseline?
build-perf-baseline installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.