aspnet-core
Build, debug, modernize, or review ASP.NET Core applications with correct hosting, middleware, security, configuration, logging, and deployment patterns on…
Establish build performance baselines and apply systematic optimization techniques. USE FOR: diagnosing slow builds, establishing before/after measurements (cold, warm, no-op scenarios), applying optimization strategies like static graph builds, artifacts output, and dependency
$ npx -y skills add managedcode/dotnet-skills --skill build-perf-baseline --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/build-perf-baselineContext preview
The summary Claude sees to decide when to auto-load this skill.
Establish build performance baselines and apply systematic optimization techniques. USE FOR: diagnosing slow builds, establishing before/after measurements (cold, warm, no-op scenarios), applying optimization strategies like static graph builds, artifacts output, and dependency
name: build-perf-baseline description: "Establish build performance baselines and apply systematic optimization techniques. USE FOR: diagnosing slow builds, establishing before/after measurements (cold, warm, no-op scenarios), applying optimization strategies like static graph builds, artifacts output, and dependency graph trimming. Start here before diving into build-perf-diagnostics, incremental-build, or build-parallelism. DO NOT USE FOR: non-MSBuild build systems, detailed bottleneck analysis (use build-perf-diagnostics after baselining)." 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:
No previous build output exists. Measures the full end-to-end time including restore, compilation, and all targets.
# Clean everything first
dotnet clean
# Remove bin/obj to truly start fresh
Get-ChildItem -Recurse -Directory -Include bin,obj | Remove-Item -Recurse -Force
# OR on Linux/macOS:
# find . -type d \( -name bin -o -name obj \) -exec rm -rf {} +
# Measure cold build
dotnet build /bl:cold-build.binlog -mBuild output exists, some files have changed. Measures how well incremental build works.
# Build once to populate outputs dotnet build -m # Make a small change (touch one .cs file) # Then rebuild dotnet build /bl:warm-build.binlog -m
Build output exists, nothing has changed. This should be nearly instant. If it's slow, incremental build is broken.
# Build once to populate outputs dotnet build -m # Rebuild immediately without changes dotnet build /bl:noop-build.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 | < 5 seconds for small repos, < 30 seconds for large repos. All compilation targets should report "Skipping target — all outputs up-to-date" |
**Red flags:**
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.
<!-- Directory.Build.props --> <PropertyGroup> <UseArtifactsOutput>true</UseArtifactsOutput> </PropertyGroup>
# Traditional layout (before)
src/
MyLib/
bin/Debug/net8.0/MyLib.dll
obj/Debug/net8.0/...
MyApp/
bin/Debug/net8.0/MyApp.dll
# Artifacts layout (after)
artifacts/
bin/MyLib/debug/MyLib.dll
bin/MyApp/debug/MyApp.dll
obj/MyLib/debug/...
obj/MyApp/debug/...<!-- Change the artifacts root --> <PropertyGroup> <ArtifactsPath>$(MSBuildThisFileDirectory)output</ArtifactsPath> </PropertyGroup>
---
Deterministic builds produce byte-for-byte identical output given the same inputs. This is essential for build caching and reproducibility.
<!-- Directory.Build.props --> <PropertyGroup> <!-- Enabled by default in .NET SDK projects since SDK 2.0+ --> <Deterministic>true</Deterministic> <!-- For full reproducibility, also set: --> <ContinuousIntegrationBuild Condition="'$(CI)' == 'true'">true</ContinuousIntegrationBuild> </PropertyGroup>
---
Reducing unnecessary project references shortens the critical path and reduces what gets built.
# Visualize the dependency graph dotnet build /bl:graph.binlog # In the binlog, check project references and build times # Look for projects that are referenced but could be trimmed
<!-- BAD: Utils is already referenced transitively via Core --> <ItemGroup> <ProjectReference Include="..\Core\Core.csproj" /> <ProjectReference Include="..\Utils\Utils.csproj" /> </ItemGroup> <!-- GOOD: Let transi
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.
Repo: managedcode/dotnet-skills
Build, debug, modernize, or review ASP.NET Core applications with correct hosting, middleware, security, configuration, logging, and deployment patterns on…
Build, upgrade, and operate Aspire 13.5.x C# or TypeScript application hosts with the current CLI, AppHost, ServiceDefaults, integrations, dashboard, testing,…
Build, review, or migrate Azure Functions in .NET with correct execution model, isolated worker setup, bindings, DI, and Durable Functions patterns. USE FOR:…
Build and review Blazor applications across server, WebAssembly, web app, and hybrid scenarios with correct component design, state flow, rendering, and…
Maintain or migrate EF6-based applications with realistic guidance on what to keep, what to modernize, and when EF Core is or is not the right next step. USE…
Design, tune, or review EF Core data access with proper modeling, migrations, query translation, performance, and lifetime management for modern .NET…