aspnet-core
Build, debug, modernize, or review ASP.NET Core applications with correct hosting, middleware, security, configuration, logging,…
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
Claude Code
$ npx -y skills add managedcode/dotnet-skills --skill build-perf-baseline --agent claude-code
Codex
$ npx skills add managedcode/dotnet-skills --skill build-perf-baseline -a codex -y
Cursor
$ npx skills add managedcode/dotnet-skills --skill build-perf-baseline -a cursor -y
Gemini CLI
$ npx skills add managedcode/dotnet-skills --skill build-perf-baseline -a gemini-cli -y
GitHub Copilot
$ npx skills add managedcode/dotnet-skills --skill build-perf-baseline -a github-copilot -y
OpenCode
$ npx skills add managedcode/dotnet-skills --skill build-perf-baseline -a opencode -y
Windsurf
$ npx skills add managedcode/dotnet-skills --skill build-perf-baseline -a windsurf -y
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
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:**
---
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.
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
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
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
| 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:**
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.
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.
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 | | |
---
The `UseArtifactsOutput` feature (introduced in .NET 8) changes the output directory structure to avoid bin/obj clash issues and enable better caching.
Stop explaining .NET to your AI. Start building. We've all been there: asking Claude to use Entity Framework, only to get EF6 patterns in a .NET 8 project. Explaining to Copilot that Blazor Server and Blazor WebAssembly aren't the same thing.
Build, debug, modernize, or review ASP.NET Core applications with correct hosting, middleware, security, configuration, logging,…
Build, upgrade, and operate Aspire 13.5.x C# or TypeScript application hosts with the current CLI, AppHost, ServiceDefaults,…
Build and debug Avalonia 11/12 .NET applications with XAML, compiled bindings, MVVM, custom controls, desktop lifetimes, and…
Build, review, or migrate Azure Functions in .NET with correct execution model, isolated worker setup, bindings, DI, and Durable…
Build and review Blazor applications across server, WebAssembly, web app, and hybrid scenarios with correct component design,…
Maintain or migrate EF6-based applications with realistic guidance on what to keep, what to modernize, and when EF Core is or is…
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…
Ask which skill or flow fits your situation. A router over the skills in this repo.