[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M756JKCHMA16AKVR2WFKRSBA":3,"skill-same:01M756JKCHMA16AKVR2WFKRSBA":45},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":14,"repositoryHtmlUrl":27,"repositoryHomepageUrl":6,"ownerHtmlUrl":28,"ownerBlogUrl":29,"ownerDescription":6,"updatedAt":30,"install":31,"resources":44},"01M756JKCHMA16AKVR2WFKRSBA","build-perf-baseline",null,"Establish build performance baselines and apply systematic optimization techniques. Only activate in MSBuild\u002F.NET build context. USE FOR: diagnosing slow builds, establishing before\u002Fafter 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).","weiflycc-cmd\u002Fskills","weiflycc-cmd","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F250846518?v=4","01M756C4PFGZJWKK04WFB9S5XF","威飛工作室","01M756C4QJJ66QDXN2RN6SXY87",0,"MIT","https:\u002F\u002Fgithub.com\u002Fweiflycc-cmd\u002Fskills\u002Fblob\u002Fmain\u002Fplugins\u002Fdotnet-msbuild\u002Fskills\u002Fbuild-perf-baseline\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: build-perf-baseline\ndescription: \"Establish build performance baselines and apply systematic optimization techniques. Only activate in MSBuild\u002F.NET build context. USE FOR: diagnosing slow builds, establishing before\u002Fafter 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).\"\nlicense: MIT\n---\n\n# Build Performance Baseline & Optimization\n\n## Overview\n\nBefore optimizing a build, you need a **baseline**. Without measurements, optimization is guesswork. This skill covers how to establish baselines and apply systematic optimization techniques.\n\n**Related skills:**\n- `build-perf-diagnostics` — binlog-based bottleneck identification\n- `incremental-build` — Inputs\u002FOutputs and up-to-date checks\n- `build-parallelism` — parallel and graph build tuning\n- `eval-performance` — glob and import chain optimization\n\n---\n\n## Step 1: Establish a Performance Baseline\n\nMeasure three scenarios to understand where time is spent:\n\n### Cold Build (First Build)\n\nNo previous build output exists. Measures the full end-to-end time including restore, compilation, and all targets.\n\n```bash\n# Clean everything first\ndotnet clean\n# Remove bin\u002Fobj to truly start fresh\nGet-ChildItem -Recurse -Directory -Include bin,obj | Remove-Item -Recurse -Force\n# OR on Linux\u002FmacOS:\n# find . -type d \\( -name bin -o -name obj \\) -exec rm -rf {} +\n\n# Measure cold build\ndotnet build \u002Fbl:cold-build.binlog -m\n```\n\n### Warm Build (Incremental Build)\n\nBuild output exists, some files have changed. Measures how well incremental build works.\n\n```bash\n# Build once to populate outputs\ndotnet build -m\n\n# Make a small change (touch one .cs file)\n# Then rebuild\ndotnet build \u002Fbl:warm-build.binlog -m\n```\n\n### No-Op Build (Nothing Changed)\n\nBuild output exists, nothing has changed. This should be nearly instant. If it's slow, incremental build is broken.\n\n```bash\n# Build once to populate outputs\ndotnet build -m\n\n# Rebuild immediately without changes\ndotnet build \u002Fbl:noop-build.binlog -m\n```\n\n### What Good Looks Like\n\n| Scenario | Expected Behavior |\n|----------|------------------|\n| Cold build | Full compilation, all targets run. This is your absolute baseline |\n| Warm build | Only changed projects recompile. Time proportional to change scope |\n| No-op build | \u003C 5 seconds for small repos, \u003C 30 seconds for large repos. All compilation targets should report \"Skipping target — all outputs up-to-date\" |\n\n**Red flags:**\n- No-op build > 30 seconds → incremental build is broken (see `incremental-build` skill)\n- Warm build recompiles everything → project dependency chain forces full rebuild\n- Cold build has long restore → NuGet cache issues\n\n### Recording Baselines\n\nRecord baselines in a structured way before and after optimization:\n\n```\n| Scenario    | Before  | After   | Improvement |\n|-------------|---------|---------|-------------|\n| Cold build  | 2m 15s  |         |             |\n| Warm build  | 1m 40s  |         |             |\n| No-op build | 45s     |         |             |\n```\n\n---\n\n## Step 2: MSBuild Server (Persistent Build Process)\n\nThe MSBuild server keeps the build process alive between invocations, avoiding JIT compilation and assembly loading overhead on every build.\n\n### Enabling MSBuild Server\n\n```bash\n# Enabled by default in .NET 8+ but can be forced\ndotnet build \u002Fp:UseSharedCompilation=true\n```\n\nThe MSBuild server is started automatically and reused across builds. The compiler server (VBCSCompiler \u002F `dotnet build-server`) is separate but complementary.\n\n### Managing the Build Server\n\n```bash\n# Check if the server is running\ndotnet build-server status\n\n# Shut down all build servers (useful when debugging)\ndotnet build-server shutdown\n```\n\n### When to Restart the Build Server\n\nRestart after:\n- Updating the .NET SDK\n- Changing MSBuild tooling (custom tasks, props, targets)\n- Debugging build infrastructure issues\n- Seeing stale behavior in repeated builds\n\n```bash\ndotnet build-server shutdown\ndotnet build\n```\n\n---\n\n## Step 3: Artifacts Output Layout\n\nThe `UseArtifactsOutput` feature (introduced in .NET 8) changes the output directory structure to avoid bin\u002Fobj clash issues and enable better caching.\n\n### Enabling Artifacts Output\n\n```xml\n\u003C!-- Directory.Build.props -->\n\u003CPropertyGroup>\n  \u003CUseArtifactsOutput>true\u003C\u002FUseArtifactsOutput>\n\u003C\u002FPropertyGroup>\n```\n\n### Before vs After\n\n```\n# Traditional layout (before)\nsrc\u002F\n  MyLib\u002F\n    bin\u002FDebug\u002Fnet8.0\u002FMyLib.dll\n    obj\u002FDebug\u002Fnet8.0\u002F...\n  MyApp\u002F\n    bin\u002FDebug\u002Fnet8.0\u002FMyApp.dll\n\n# Artifacts layout (after)\nartifacts\u002F\n  bin\u002FMyLib\u002Fdebug\u002FMyLib.dll\n  bin\u002FMyApp\u002Fdebug\u002FMyApp.dll\n  obj\u002FMyLib\u002Fdebug\u002F...\n  obj\u002FMyApp\u002Fdebug\u002F...\n```\n\n### Benefits\n\n- **No bin\u002Fobj clash**: Each project+configuration gets a unique path automatically\n- **Easier to cache**: Single `artifacts\u002F` directory to cache\u002Frestore in CI\n- **Cleaner .gitignore**: Just ignore `artifacts\u002F`\n- **Multi-targeting safe**: Each TFM gets its own subdirectory\n\n### Customizing\n\n```xml\n\u003C!-- Change the artifacts root -->\n\u003CPropertyGroup>\n  \u003CArtifactsPath>$(MSBuildThisFileDirectory)output\u003C\u002FArtifactsPath>\n\u003C\u002FPropertyGroup>\n```\n\n---\n\n## Step 4: Deterministic Builds\n\nDeterministic builds produce byte-for-byte identical output given the same inputs. This is essential for build caching and reproducibility.\n\n### Enabling Deterministic Builds\n\n```xml\n\u003C!-- Directory.Build.props -->\n\u003CPropertyGroup>\n  \u003C!-- Enabled by default in .NET SDK projects since SDK 2.0+ -->\n  \u003CDeterministic>true\u003C\u002FDeterministic>\n\n  \u003C!-- For full reproducibility, also set: -->\n  \u003CContinuousIntegrationBuild Condition=\"'$(CI)' == 'true'\">true\u003C\u002FContinuousIntegrationBuild>\n\u003C\u002FPropertyGroup>\n```\n\n### What Deterministic Affects\n\n- Removes timestamps from PE headers\n- Uses consistent file paths in PDBs\n- Produces identical output for identical input\n\n### Why It Matters for Performance\n\n- **Build caching**: If outputs are deterministic, you can cache and reuse them across builds and machines\n- **CI optimization**: Skip rebuilding unchanged projects by comparing inputs\n- **Distributed builds**: Safe to cache compilation results in shared storage\n\n---\n\n## Step 5: Dependency Graph Trimming\n\nReducing unnecessary project references shortens the critical path and reduces what gets built.\n\n### Audit the Dependency Graph\n\n```bash\n# Visualize the dependency graph\ndotnet build \u002Fbl:graph.binlog\n\n# In the binlog, check project references and build times\n# Look for projects that are referenced but could be trimmed\n```\n\n### Techniques\n\n#### Remove Redundant Transitive References\n\n```xml\n\u003C!-- BAD: Utils is already referenced transitively via Core -->\n\u003CItemGroup>\n  \u003CProjectReference Include=\"..\\Core\\Core.csproj\" \u002F>\n  \u003CProjectReference Include=\"..\\Utils\\Utils.csproj\" \u002F>\n\u003C\u002FItemGroup>\n\n\u003C!-- GOOD: Let transitive references flow automatically -->\n\u003CItemGroup>\n  \u003CProjectReference Include=\"..\\Core\\Core.csproj\" \u002F>\n\u003C\u002FItemGroup>\n```\n\n#### Build-Order-Only References\n\nWhen you need a project to build before yours but don't need its assembly output:\n\n```xml\n\u003C!-- Only ensures build order, doesn't reference the output assembly -->\n\u003CProjectReference Include=\"..\\CodeGen\\CodeGen.csproj\"\n                  ReferenceOutputAssembly=\"false\" \u002F>\n```\n\n#### Prevent Transitive Flow\n\nWhen a dependency is an internal implementation detail that shouldn't flow to consumers:\n\n```xml\n\u003C!-- Don't expose this dependency transitively -->\n\u003CProjectReference Include=\"..\\InternalHelpers\\InternalHelpers.csproj\"\n                  PrivateAssets=\"all\" \u002F>\n```\n\n#### Disable Transitive Project References\n\nFor explicit-only dependency management (extreme measure for very large repos):\n\n```xml\n\u003CPropertyGroup>\n  \u003CDisableTransitiveProjectReferences>true\u003C\u002FDisableTransitiveProjectReferences>\n\u003C\u002FPropertyGroup>\n```\n\n**Caution**: This requires all dependencies to be listed explicitly. Only use in large repos where transitive closure is causing excessive rebuilds.\n\n---\n\n## Step 6: Static Graph Builds (`\u002Fgraph`)\n\nStatic graph mode evaluates the entire project graph before building, enabling better scheduling and isolation.\n\n### Enabling Graph Build\n\n```bash\n# Single invocation\ndotnet build \u002Fgraph\n\n# With binary log for analysis\ndotnet build \u002Fgraph \u002Fbl:graph-build.binlog\n```\n\n### Benefits\n\n- **Better parallelism**: MSBuild knows the full graph upfront and can schedule optimally\n- **Build isolation**: Each project builds in isolation (no cross-project state leakage)\n- **Caching potential**: With isolation, individual project results can be cached\n\n### When to Use\n\n| Scenario | Recommendation |\n|----------|---------------|\n| Large multi-project solution (20+ projects) | ✅ Try `\u002Fgraph` — may see significant parallelism gains |\n| Small solution (\u003C 5 projects) | ❌ Overhead of graph evaluation outweighs benefits |\n| CI builds | ✅ Graph builds are more predictable and parallelizable |\n| Local development | ⚠️ Test both — may or may not help depending on project structure |\n\n### Troubleshooting Graph Build\n\nGraph build requires that all `ProjectReference` items are statically determinable (no dynamic references computed in targets). If graph build fails:\n\n```\nerror MSB4260: Project reference \"...\" could not be resolved with static graph.\n```\n\n**Fix**: Ensure all `ProjectReference` items are declared in `\u003CItemGroup>` outside of targets (not dynamically computed inside `\u003CTarget>` blocks).\n\n---\n\n## Step 7: Parallel Build Tuning\n\n### MaxCpuCount\n\n```bash\n# Use all available cores (default in dotnet build)\ndotnet build -m\n\n# Specify explicit core count (useful for CI with shared agents)\ndotnet build -m:4\n\n# MSBuild.exe syntax\nmsbuild \u002Fm:8 MySolution.sln\n```\n\n### Identifying Parallelism Bottlenecks\n\nIn a binlog, look for:\n- **Long sequential chains**: Projects that must build one after another due to dependencies\n- **Uneven load**: Some build nodes idle while others are overloaded\n- **Single-project bottleneck**: One large project on the critical path that blocks everything\n\nUse `grep 'Target Performance Summary' -A 30 full.log` in binlog analysis to see build node utilization.\n\n### Reducing the Critical Path\n\nThe critical path is the longest chain of dependent projects. To shorten it:\n\n1. **Break large projects into smaller ones** that can build in parallel\n2. **Remove unnecessary ProjectReferences** (see Step 5)\n3. **Use `ReferenceOutputAssembly=\"false\"`** for build-order-only dependencies\n4. **Move shared code to a base library** that builds first, then parallelize consumers\n\n---\n\n## Step 8: Additional Quick Wins\n\n### Separate Restore from Build\n\n```bash\n# In CI, restore once then build without restore\ndotnet restore\ndotnet build --no-restore -m\ndotnet test --no-build\n```\n\n### Skip Unnecessary Targets\n\n```bash\n# Skip building documentation\ndotnet build \u002Fp:GenerateDocumentationFile=false\n\n# Skip analyzers during development (not for CI!)\ndotnet build \u002Fp:RunAnalyzers=false\n```\n\n### Use Project-Level Filtering\n\n```bash\n# Build only the project you're working on (and its dependencies)\ndotnet build src\u002FMyApp\u002FMyApp.csproj\n\n# Don't build the entire solution if you only need one project\n```\n\n### Binary Log for All Investigations\n\nAlways start with a binlog:\n```bash\ndotnet build \u002Fbl:perf.binlog -m\n```\n\nThen use the `build-perf-diagnostics` skill and binlog tools for systematic bottleneck identification.\n\n---\n\n## Optimization Decision Tree\n\n```\nIs your no-op build slow (> 10s per project)?\n├── YES → See `incremental-build` skill (fix Inputs\u002FOutputs)\n└── NO\n    Is your cold build slow?\n    ├── YES\n    │   Is restore slow?\n    │   ├── YES → Optimize NuGet restore (use lock files, configure local cache)\n    │   └── NO\n    │       Is compilation slow?\n    │       ├── YES\n    │       │   Are analyzers\u002Fgenerators slow?\n    │       │   ├── YES → See `build-perf-diagnostics` skill\n    │       │   └── NO → Check parallelism, graph build, critical path (this skill + `build-parallelism`)\n    │       └── NO → Check custom targets (binlog analysis via `build-perf-diagnostics`)\n    └── NO\n        Is your warm build slow?\n        ├── YES → Projects rebuilding unnecessarily → check `incremental-build` skill\n        └── NO → Build is healthy! Consider graph build or UseArtifactsOutput for further gains\n```\n","# Build Performance Baseline & Optimization\n\n## Overview\n\nBefore optimizing a build, you need a **baseline**. Without measurements, optimization is guesswork. This skill covers how to establish baselines and apply systematic optimization techniques.\n\n**Related skills:**\n- `build-perf-diagnostics` — binlog-based bottleneck identification\n- `incremental-build` — Inputs\u002FOutputs and up-to-date checks\n- `build-parallelism` — parallel and graph build tuning\n- `eval-performance` — glob and import chain optimization\n\n---\n\n## Step 1: Establish a Performance Baseline\n\nMeasure three scenarios to understand where time is spent:\n\n### Cold Build (First Build)\n\nNo previous build output exists. Measures the full end-to-end time including restore, compilation, and all targets.\n\n```bash\n# Clean everything first\ndotnet clean\n# Remove bin\u002Fobj to truly start fresh\nGet-ChildItem -Recurse -Directory -Include bin,obj | Remove-Item -Recurse -Force\n# OR on Linux\u002FmacOS:\n# find . -type d \\( -name bin -o -name obj \\) -exec rm -rf {} +\n\n# Measure cold build\ndotnet build \u002Fbl:cold-build.binlog -m\n```\n\n### Warm Build (Incremental Build)\n\nBuild output exists, some files have changed. Measures how well incremental build works.\n\n```bash\n# Build once to populate outputs\ndotnet build -m\n\n# Make a small change (touch one .cs file)\n# Then rebuild\ndotnet build \u002Fbl:warm-build.binlog -m\n```\n\n### No-Op Build (Nothing Changed)\n\nBuild output exists, nothing has changed. This should be nearly instant. If it's slow, incremental build is broken.\n\n```bash\n# Build once to populate outputs\ndotnet build -m\n\n# Rebuild immediately without changes\ndotnet build \u002Fbl:noop-build.binlog -m\n```\n\n### What Good Looks Like\n\n| Scenario | Expected Behavior |\n|----------|------------------|\n| Cold build | Full compilation, all targets run. This is your absolute baseline |\n| Warm build | Only changed projects recompile. Time proportional to change scope |\n| No-op build | \u003C 5 seconds for small repos, \u003C 30 seconds for large repos. All compilation targets should report \"Skipping target — all outputs up-to-date\" |\n\n**Red flags:**\n- No-op build > 30 seconds → incremental build is broken (see `incremental-build` skill)\n- Warm build recompiles everything → project dependency chain forces full rebuild\n- Cold build has long restore → NuGet cache issues\n\n### Recording Baselines\n\nRecord baselines in a structured way before and after optimization:\n\n```\n| Scenario    | Before  | After   | Improvement |\n|-------------|---------|---------|-------------|\n| Cold build  | 2m 15s  |         |             |\n| Warm build  | 1m 40s  |         |             |\n| No-op build | 45s     |         |             |\n```\n\n---\n\n## Step 2: MSBuild Server (Persistent Build Process)\n\nThe MSBuild server keeps the build process alive between invocations, avoiding JIT compilation and assembly loading overhead on every build.\n\n### Enabling MSBuild Server\n\n```bash\n# Enabled by default in .NET 8+ but can be forced\ndotnet build \u002Fp:UseSharedCompilation=true\n```\n\nThe MSBuild server is started automatically and reused across builds. The compiler server (VBCSCompiler \u002F `dotnet build-server`) is separate but complementary.\n\n### Managing the Build Server\n\n```bash\n# Check if the server is running\ndotnet build-server status\n\n# Shut down all build servers (useful when debugging)\ndotnet build-server shutdown\n```\n\n### When to Restart the Build Server\n\nRestart after:\n- Updating the .NET SDK\n- Changing MSBuild tooling (custom tasks, props, targets)\n- Debugging build infrastructure issues\n- Seeing stale behavior in repeated builds\n\n```bash\ndotnet build-server shutdown\ndotnet build\n```\n\n---\n\n## Step 3: Artifacts Output Layout\n\nThe `UseArtifactsOutput` feature (introduced in .NET 8) changes the output directory structure to avoid bin\u002Fobj clash issues and enable better caching.\n\n### Enabling Artifacts Output\n\n```xml\n\u003C!-- Directory.Build.props -->\n\u003CPropertyGroup>\n  \u003CUseArtifactsOutput>true\u003C\u002FUseArtifactsOutput>\n\u003C\u002FPropertyGroup>\n```\n\n### Before vs After\n\n```\n# Traditional layout (before)\nsrc\u002F\n  MyLib\u002F\n    bin\u002FDebug\u002Fnet8.0\u002FMyLib.dll\n    obj\u002FDebug\u002Fnet8.0\u002F...\n  MyApp\u002F\n    bin\u002FDebug\u002Fnet8.0\u002FMyApp.dll\n\n# Artifacts layout (after)\nartifacts\u002F\n  bin\u002FMyLib\u002Fdebug\u002FMyLib.dll\n  bin\u002FMyApp\u002Fdebug\u002FMyApp.dll\n  obj\u002FMyLib\u002Fdebug\u002F...\n  obj\u002FMyApp\u002Fdebug\u002F...\n```\n\n### Benefits\n\n- **No bin\u002Fobj clash**: Each project+configuration gets a unique path automatically\n- **Easier to cache**: Single `artifacts\u002F` directory to cache\u002Frestore in CI\n- **Cleaner .gitignore**: Just ignore `artifacts\u002F`\n- **Multi-targeting safe**: Each TFM gets its own subdirectory\n\n### Customizing\n\n```xml\n\u003C!-- Change the artifacts root -->\n\u003CPropertyGroup>\n  \u003CArtifactsPath>$(MSBuildThisFileDirectory)output\u003C\u002FArtifactsPath>\n\u003C\u002FPropertyGroup>\n```\n\n---\n\n## Step 4: Deterministic Builds\n\nDeterministic builds produce byte-for-byte identical output given the same inputs. This is essential for build caching and reproducibility.\n\n### Enabling Deterministic Builds\n\n```xml\n\u003C!-- Directory.Build.props -->\n\u003CPropertyGroup>\n  \u003C!-- Enabled by default in .NET SDK projects since SDK 2.0+ -->\n  \u003CDeterministic>true\u003C\u002FDeterministic>\n\n  \u003C!-- For full reproducibility, also set: -->\n  \u003CContinuousIntegrationBuild Condition=\"'$(CI)' == 'true'\">true\u003C\u002FContinuousIntegrationBuild>\n\u003C\u002FPropertyGroup>\n```\n\n### What Deterministic Affects\n\n- Removes timestamps from PE headers\n- Uses consistent file paths in PDBs\n- Produces identical output for identical input\n\n### Why It Matters for Performance\n\n- **Build caching**: If outputs are deterministic, you can cache and reuse them across builds and machines\n- **CI optimization**: Skip rebuilding unchanged projects by comparing inputs\n- **Distributed builds**: Safe to cache compilation results in shared storage\n\n---\n\n## Step 5: Dependency Graph Trimming\n\nReducing unnecessary project references shortens the critical path and reduces what gets built.\n\n### Audit the Dependency Graph\n\n```bash\n# Visualize the dependency graph\ndotnet build \u002Fbl:graph.binlog\n\n# In the binlog, check project references and build times\n# Look for projects that are referenced but could be trimmed\n```\n\n### Techniques\n\n#### Remove Redundant Transitive References\n\n```xml\n\u003C!-- BAD: Utils is already referenced transitively via Core -->\n\u003CItemGroup>\n  \u003CProjectReference Include=\"..\\Core\\Core.csproj\" \u002F>\n  \u003CProjectReference Include=\"..\\Utils\\Utils.csproj\" \u002F>\n\u003C\u002FItemGroup>\n\n\u003C!-- GOOD: Let transitive references flow automatically -->\n\u003CItemGroup>\n  \u003CProjectReference Include=\"..\\Core\\Core.csproj\" \u002F>\n\u003C\u002FItemGroup>\n```\n\n#### Build-Order-Only References\n\nWhen you need a project to build before yours but don't need its assembly output:\n\n```xml\n\u003C!-- Only ensures build order, doesn't reference the output assembly -->\n\u003CProjectReference Include=\"..\\CodeGen\\CodeGen.csproj\"\n                  ReferenceOutputAssembly=\"false\" \u002F>\n```\n\n#### Prevent Transitive Flow\n\nWhen a dependency is an internal implementation detail that shouldn't flow to consumers:\n\n```xml\n\u003C!-- Don't expose this dependency transitively -->\n\u003CProjectReference Include=\"..\\InternalHelpers\\InternalHelpers.csproj\"\n                  PrivateAssets=\"all\" \u002F>\n```\n\n#### Disable Transitive Project References\n\nFor explicit-only dependency management (extreme measure for very large repos):\n\n```xml\n\u003CPropertyGroup>\n  \u003CDisableTransitiveProjectReferences>true\u003C\u002FDisableTransitiveProjectReferences>\n\u003C\u002FPropertyGroup>\n```\n\n**Caution**: This requires all dependencies to be listed explicitly. Only use in large repos where transitive closure is causing excessive rebuilds.\n\n---\n\n## Step 6: Static Graph Builds (`\u002Fgraph`)\n\nStatic graph mode evaluates the entire project graph before building, enabling better scheduling and isolation.\n\n### Enabling Graph Build\n\n```bash\n# Single invocation\ndotnet build \u002Fgraph\n\n# With binary log for analysis\ndotnet build \u002Fgraph \u002Fbl:graph-build.binlog\n```\n\n### Benefits\n\n- **Better parallelism**: MSBuild knows the full graph upfront and can schedule optimally\n- **Build isolation**: Each project builds in isolation (no cross-project state leakage)\n- **Caching potential**: With isolation, individual project results can be cached\n\n### When to Use\n\n| Scenario | Recommendation |\n|----------|---------------|\n| Large multi-project solution (20+ projects) | ✅ Try `\u002Fgraph` — may see significant parallelism gains |\n| Small solution (\u003C 5 projects) | ❌ Overhead of graph evaluation outweighs benefits |\n| CI builds | ✅ Graph builds are more predictable and parallelizable |\n| Local development | ⚠️ Test both — may or may not help depending on project structure |\n\n### Troubleshooting Graph Build\n\nGraph build requires that all `ProjectReference` items are statically determinable (no dynamic references computed in targets). If graph build fails:\n\n```\nerror MSB4260: Project reference \"...\" could not be resolved with static graph.\n```\n\n**Fix**: Ensure all `ProjectReference` items are declared in `\u003CItemGroup>` outside of targets (not dynamically computed inside `\u003CTarget>` blocks).\n\n---\n\n## Step 7: Parallel Build Tuning\n\n### MaxCpuCount\n\n```bash\n# Use all available cores (default in dotnet build)\ndotnet build -m\n\n# Specify explicit core count (useful for CI with shared agents)\ndotnet build -m:4\n\n# MSBuild.exe syntax\nmsbuild \u002Fm:8 MySolution.sln\n```\n\n### Identifying Parallelism Bottlenecks\n\nIn a binlog, look for:\n- **Long sequential chains**: Projects that must build one after another due to dependencies\n- **Uneven load**: Some build nodes idle while others are overloaded\n- **Single-project bottleneck**: One large project on the critical path that blocks everything\n\nUse `grep 'Target Performance Summary' -A 30 full.log` in binlog analysis to see build node utilization.\n\n### Reducing the Critical Path\n\nThe critical path is the longest chain of dependent projects. To shorten it:\n\n1. **Break large projects into smaller ones** that can build in parallel\n2. **Remove unnecessary ProjectReferences** (see Step 5)\n3. **Use `ReferenceOutputAssembly=\"false\"`** for build-order-only dependencies\n4. **Move shared code to a base library** that builds first, then parallelize consumers\n\n---\n\n## Step 8: Additional Quick Wins\n\n### Separate Restore from Build\n\n```bash\n# In CI, restore once then build without restore\ndotnet restore\ndotnet build --no-restore -m\ndotnet test --no-build\n```\n\n### Skip Unnecessary Targets\n\n```bash\n# Skip building documentation\ndotnet build \u002Fp:GenerateDocumentationFile=false\n\n# Skip analyzers during development (not for CI!)\ndotnet build \u002Fp:RunAnalyzers=false\n```\n\n### Use Project-Level Filtering\n\n```bash\n# Build only the project you're working on (and its dependencies)\ndotnet build src\u002FMyApp\u002FMyApp.csproj\n\n# Don't build the entire solution if you only need one project\n```\n\n### Binary Log for All Investigations\n\nAlways start with a binlog:\n```bash\ndotnet build \u002Fbl:perf.binlog -m\n```\n\nThen use the `build-perf-diagnostics` skill and binlog tools for systematic bottleneck identification.\n\n---\n\n## Optimization Decision Tree\n\n```\nIs your no-op build slow (> 10s per project)?\n├── YES → See `incremental-build` skill (fix Inputs\u002FOutputs)\n└── NO\n    Is your cold build slow?\n    ├── YES\n    │   Is restore slow?\n    │   ├── YES → Optimize NuGet restore (use lock files, configure local cache)\n    │   └── NO\n    │       Is compilation slow?\n    │       ├── YES\n    │       │   Are analyzers\u002Fgenerators slow?\n    │       │   ├── YES → See `build-perf-diagnostics` skill\n    │       │   └── NO → Check parallelism, graph build, critical path (this skill + `build-parallelism`)\n    │       └── NO → Check custom targets (binlog analysis via `build-perf-diagnostics`)\n    └── NO\n        Is your warm build slow?\n        ├── YES → Projects rebuilding unnecessarily → check `incremental-build` skill\n        └── NO → Build is healthy! Consider graph build or UseArtifactsOutput for further gains\n```\n",{"name":5,"license":15,"description":7},"main","5810d492c9b301d8227f932bf87b5c954c4fa4d6","plugins\u002Fdotnet-msbuild\u002Fskills\u002Fbuild-perf-baseline","https:\u002F\u002Fgithub.com\u002Fweiflycc-cmd\u002Fskills","https:\u002F\u002Fgithub.com\u002Fweiflycc-cmd","weiflycc.com","2026-11-10 03:26:55",{"source":8,"skillName":5,"commands":32,"prompt":42,"zipAvailable":43},[33,36,39],{"tool":34,"command":35},"npx","npx skills add weiflycc-cmd\u002Fskills --skill build-perf-baseline",{"tool":37,"command":38},"bunx","bunx skills add weiflycc-cmd\u002Fskills --skill build-perf-baseline",{"tool":40,"command":41},"pnpm","pnpm dlx skills add weiflycc-cmd\u002Fskills --skill build-perf-baseline","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fweiflycc-cmd\u002Fskills\u002Fblob\u002Fmain\u002Fplugins\u002Fdotnet-msbuild\u002Fskills\u002Fbuild-perf-baseline\u002FSKILL.md",true,[],[46,53,60,67,74,81],{"skillNo":47,"name":48,"nameZh":6,"description":49,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":50,"categories":51,"keywords":52,"publishedAt":19},"01M76SGT4WG5682JQJ0V3NSK6X","system-text-json-net11","Provides guidance on new System.Text.Json APIs introduced in .NET 11. It covers typed JsonTypeInfo access via GetTypeInfo\u003CT> and TryGetTypeInfo\u003CT> on JsonSerializerOptions, and the new JsonNamingPolicy.PascalCase static property. Use when serializing or deserializing JSON in .NET 11 applications and needing typed metadata access or PascalCase property naming.","https:\u002F\u002Fgithub.com\u002Fweiflycc-cmd\u002Fskills\u002Fblob\u002Fmain\u002Fplugins\u002Fdotnet11\u002Fskills\u002Fsystem-text-json-net11\u002FSKILL.md",[],[],{"skillNo":54,"name":55,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":57,"categories":58,"keywords":59,"publishedAt":19},"01M76SGPNZYYV9BCZJW7BF7J8A","nuget-trusted-publishing","Set up NuGet trusted publishing (OIDC) on a GitHub Actions repo — replaces long-lived API keys with short-lived tokens. USE FOR: trusted publishing, NuGet OIDC, keyless NuGet publish, migrate from NuGet API key, NuGet\u002Flogin, secure NuGet publishing. DO NOT USE FOR: publishing to private feeds or Azure Artifacts (OIDC is nuget.org only). INVOKES: shell (powershell or bash), edit, create, ask_user for guided repo setup.","https:\u002F\u002Fgithub.com\u002Fweiflycc-cmd\u002Fskills\u002Fblob\u002Fmain\u002Fplugins\u002Fdotnet\u002Fskills\u002Fnuget-trusted-publishing\u002FSKILL.md",[],[],{"skillNo":61,"name":62,"nameZh":6,"description":63,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":64,"categories":65,"keywords":66,"publishedAt":19},"01M76SGHVNBNVM1DMVDYTMAE5G","dotnet-pinvoke","Correctly call native (C\u002FC++) libraries from .NET using P\u002FInvoke and LibraryImport. Covers function signatures, string marshalling, memory lifetime, SafeHandle, and cross-platform patterns. USE FOR: writing new P\u002FInvoke or LibraryImport declarations, reviewing or debugging existing native interop code, wrapping a C or C++ library for use in .NET, diagnosing crashes, memory leaks, or corruption at the managed\u002Fnative boundary. DO NOT USE FOR: COM interop, C++\u002FCLI mixed-mode assemblies, or pure managed code with no native dependencies.","https:\u002F\u002Fgithub.com\u002Fweiflycc-cmd\u002Fskills\u002Fblob\u002Fmain\u002Fplugins\u002Fdotnet\u002Fskills\u002Fdotnet-pinvoke\u002FSKILL.md",[],[],{"skillNo":68,"name":69,"nameZh":6,"description":70,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":73,"publishedAt":19},"01M76SGDB9Z3GSB1CFW314NC84","csharp-scripts","Run file-based C# apps with the .NET CLI when the user explicitly wants C#\u002F.NET code without creating a project. Use for C# language\u002FAPI experiments, one-file C# apps, small multi-file C# apps composed with `#:include`\u002F`#:exclude`, or C# file-based apps linked with `#:ref`. Do not use for language-agnostic throwaway scripts, generic computations, Python\u002FPowerShell-style automation, full projects, or existing app integration.","https:\u002F\u002Fgithub.com\u002Fweiflycc-cmd\u002Fskills\u002Fblob\u002Fmain\u002Fplugins\u002Fdotnet\u002Fskills\u002Fcsharp-scripts\u002FSKILL.md",[],[],{"skillNo":75,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":19},"01M76SG805T8W764WAKB1NP3CJ","thread-abort-migration","Guides migration of .NET Framework Thread.Abort usage to cooperative cancellation in modern .NET. USE FOR: modernizing code that calls Thread.Abort, catching ThreadAbortException, replacing Thread.ResetAbort, replacing Thread.Interrupt for thread termination, resolving PlatformNotSupportedException or SYSLIB0006 after retargeting to .NET 6+, migrating ASP.NET Response.End or Response.Redirect(url, true) which internally call Thread.Abort. DO NOT USE FOR: code that only uses Thread.Join, Thread.Sleep, or Thread.Start without any abort, interrupt, or ThreadAbortException usage — these APIs work identically in modern .NET and need no migration. Also not for projects staying on .NET Framework, or Thread.Abort usage inside third-party libraries you do not control.","https:\u002F\u002Fgithub.com\u002Fweiflycc-cmd\u002Fskills\u002Fblob\u002Fmain\u002Fplugins\u002Fdotnet-upgrade\u002Fskills\u002Fthread-abort-migration\u002FSKILL.md",[],[],{"skillNo":82,"name":83,"nameZh":6,"description":84,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":19},"01M76SG2588ZJBE5C51HYJJSKV","migrate-nullable-references","Enable nullable reference types in a C# project and systematically resolve all warnings. USE FOR: adopting NRTs in existing codebases, file-by-file or project-wide migration, fixing CS8602\u002FCS8618\u002FCS86xx warnings, annotating APIs for nullability, cleaning up null-forgiving operators, upgrading dependencies with new nullable annotations. DO NOT USE FOR: projects already fully migrated with zero warnings (unless auditing suppressions), fixing a handful of nullable warnings in code that already has NRTs enabled, suppressing warnings without fixing them, C# 7.3 or earlier projects. INVOKES: Get-NullableReadiness.ps1 scanner script.","https:\u002F\u002Fgithub.com\u002Fweiflycc-cmd\u002Fskills\u002Fblob\u002Fmain\u002Fplugins\u002Fdotnet-upgrade\u002Fskills\u002Fmigrate-nullable-references\u002FSKILL.md",[],[]]