Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion eng/eval-quality/underpowered-allowlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ tests/dotnet-msbuild/eval-performance/eval.yaml
tests/dotnet-msbuild/including-generated-files/eval.yaml
tests/dotnet-msbuild/incremental-build/eval.yaml
tests/dotnet-msbuild/msbuild-modernization/eval.yaml
tests/dotnet-msbuild/msbuild-server/eval.yaml
tests/dotnet-msbuild/resolve-project-references/eval.yaml
tests/dotnet-upgrade/dotnet-aot-compat/eval.yaml
tests/dotnet-advanced/dotnet-pinvoke/eval.yaml
Expand Down
52 changes: 7 additions & 45 deletions plugins/dotnet-msbuild/skills/build-perf-baseline/SKILL.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
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 MSBuild Server, 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)."
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
---

Expand Down Expand Up @@ -90,45 +90,7 @@ Record baselines in a structured way before and after optimization:

---

## Step 2: MSBuild Server (Persistent Build Process)

The MSBuild server keeps the build process alive between invocations, avoiding JIT compilation and assembly loading overhead on every build.

### Enabling MSBuild Server

```bash
# Enabled by default in .NET 8+ but can be forced
dotnet build /p:UseSharedCompilation=true
```

The MSBuild server is started automatically and reused across builds. The compiler server (VBCSCompiler / `dotnet build-server`) is separate but complementary.

### Managing the Build Server

```bash
# Check if the server is running
dotnet build-server status

# Shut down all build servers (useful when debugging)
dotnet build-server shutdown
```

### When to Restart the Build Server

Restart after:
- Updating the .NET SDK
- Changing MSBuild tooling (custom tasks, props, targets)
- Debugging build infrastructure issues
- Seeing stale behavior in repeated builds

```bash
dotnet build-server shutdown
dotnet build
```

---

## Step 3: Artifacts Output Layout
## 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.

Expand Down Expand Up @@ -178,7 +140,7 @@ artifacts/

---

## Step 4: Deterministic Builds
## Step 3: Deterministic Builds

Deterministic builds produce byte-for-byte identical output given the same inputs. This is essential for build caching and reproducibility.

Expand Down Expand Up @@ -209,7 +171,7 @@ Deterministic builds produce byte-for-byte identical output given the same input

---

## Step 5: Dependency Graph Trimming
## Step 4: Dependency Graph Trimming

Reducing unnecessary project references shortens the critical path and reduces what gets built.

Expand Down Expand Up @@ -274,7 +236,7 @@ For explicit-only dependency management (extreme measure for very large repos):

---

## Step 6: Static Graph Builds (`/graph`)
## Step 5: Static Graph Builds (`/graph`)

Static graph mode evaluates the entire project graph before building, enabling better scheduling and isolation.

Expand Down Expand Up @@ -315,7 +277,7 @@ error MSB4260: Project reference "..." could not be resolved with static graph.

---

## Step 7: Parallel Build Tuning
## Step 6: Parallel Build Tuning

### MaxCpuCount

Expand Down Expand Up @@ -350,7 +312,7 @@ The critical path is the longest chain of dependent projects. To shorten it:

---

## Step 8: Additional Quick Wins
## Step 7: Additional Quick Wins

### Separate Restore from Build

Expand Down
69 changes: 0 additions & 69 deletions plugins/dotnet-msbuild/skills/msbuild-server/SKILL.md

This file was deleted.

10 changes: 0 additions & 10 deletions tests/dotnet-msbuild/msbuild-server/Calculator.cs

This file was deleted.

8 changes: 0 additions & 8 deletions tests/dotnet-msbuild/msbuild-server/SlowCliBuilds.csproj

This file was deleted.

16 changes: 0 additions & 16 deletions tests/dotnet-msbuild/msbuild-server/developer-report.md

This file was deleted.

25 changes: 0 additions & 25 deletions tests/dotnet-msbuild/msbuild-server/eval.yaml

This file was deleted.

Loading