Agent Skillsdotnet/skills › msbuild-server

msbuild-server

GitHub

指导在命令行中使用MSBuild Server提升增量构建性能。适用于CLI构建慢于IDE或CI场景,通过设置环境变量启用持久缓存,排除IDE环境及构建故障排查场景。

plugins/dotnet-msbuild/skills/msbuild-server/SKILL.md dotnet/skills

Trigger Scenarios

开发者报告命令行增量构建速度慢 CLI构建明显慢于IDE构建 CI代理运行大量顺序构建

Install

npx skills add dotnet/skills --skill msbuild-server -g -y
More Options

Non-standard path

npx skills add https://github.com/dotnet/skills/tree/main/plugins/dotnet-msbuild/skills/msbuild-server -g -y

Use without installing

npx skills use dotnet/skills@msbuild-server

指定 Agent (Claude Code)

npx skills add dotnet/skills --skill msbuild-server -a claude-code -g -y

安装 repo 全部 skill

npx skills add dotnet/skills --all -g -y

预览 repo 内 skill

npx skills add dotnet/skills --list

SKILL.md

Frontmatter
{
    "name": "msbuild-server",
    "license": "MIT",
    "description": "Guide for using MSBuild Server to improve CLI build performance. Activate when developers report slow incremental builds from the command line, or when CLI builds are noticeably slower than IDE builds. Covers MSBUILDUSESERVER=1 environment variable for persistent server-based caching. Do not activate for IDE-based builds (Visual Studio already uses a long-lived process)."
}

MSBuild Server for CLI Caching

Use the MSBuild Server to cache evaluation results across CLI builds, matching the performance advantage Visual Studio gets from its long-lived MSBuild process.

When to Use

  • Small incremental builds from CLI (dotnet build) are slower than expected
  • Developers notice that VS builds are faster than CLI builds for the same project
  • CI agents run many sequential builds of the same repo

When Not to Use

  • IDE-based builds (Visual Studio already uses a long-lived MSBuild process)
  • One-off builds where cold-start overhead is acceptable
  • Build correctness issues are suspected (disable the server to isolate the problem)

Inputs

Input Required Description
Shell context No The shell where the environment variable will be set (bash, PowerShell, or Windows persistent)

Workflow

Step 1: Confirm CLI context

Verify the developer is building from the command line (dotnet build), not from Visual Studio or another IDE. The MSBuild Server provides no benefit inside an IDE.

Step 2: Set the environment variable

# Bash / CI
export MSBUILDUSESERVER=1

# PowerShell
$env:MSBUILDUSESERVER = "1"

# Windows (persistent)
setx MSBUILDUSESERVER 1

Step 3: Validate improvement

Run two sequential builds of the same project and compare times:

  1. First build (cold): dotnet build -- server starts, no cache benefit
  2. Second build (warm): dotnet build -- should be noticeably faster

The most noticeable improvement is in repos with many projects or complex Directory.Build.props chains.

Validation

  • MSBUILDUSESERVER=1 is set in the shell
  • Second sequential build is faster than the first
  • dotnet build-server shutdown followed by a rebuild confirms the server restarts cleanly

Common Pitfalls

Pitfall Solution
Expecting improvement in Visual Studio VS already uses long-lived MSBuild nodes; the server adds no benefit
Build correctness issues after enabling Run dotnet build-server shutdown to reset; if issues persist, disable the server
Server process using unexpected memory The server persists in background; shut down with dotnet build-server shutdown when idle

Version History

  • ce75c35 Current 2026-07-06 00:31

Same Skill Collection

.agents/skills/create-custom-agent/SKILL.md
.agents/skills/create-skill-test/SKILL.md
.agents/skills/create-skill/SKILL.md
.agents/skills/improve-skill-quality/SKILL.md
.github/skills/agentic-workflows/SKILL.md
eng/skill-validator/tests/fixtures/sample-skill/SKILL.md
plugins/dotnet-advanced/skills/csharp-scripts/SKILL.md
plugins/dotnet-advanced/skills/nuget-trusted-publishing/SKILL.md
plugins/dotnet-aspnetcore/skills/configuring-opentelemetry-dotnet/SKILL.md
plugins/dotnet-aspnetcore/skills/dotnet-webapi/SKILL.md
plugins/dotnet-aspnetcore/skills/minimal-api-file-upload/SKILL.md
plugins/dotnet-blazor/skills/create-blazor-project/SKILL.md
plugins/dotnet-blazor/skills/fetch-and-send-data/SKILL.md
plugins/dotnet-blazor/skills/support-prerendering/SKILL.md
plugins/dotnet-blazor/skills/use-js-interop/SKILL.md
plugins/dotnet-data/skills/optimizing-ef-core-queries/SKILL.md
plugins/dotnet-diag/skills/analyzing-dotnet-performance/SKILL.md
plugins/dotnet-diag/skills/clr-activation-debugging/SKILL.md
plugins/dotnet-diag/skills/dotnet-trace-collect/SKILL.md
plugins/dotnet-diag/skills/dump-collect/SKILL.md
plugins/dotnet-experimental/skills/exp-mock-usage-analysis/SKILL.md
plugins/dotnet-experimental/skills/exp-simd-vectorization/SKILL.md
plugins/dotnet-msbuild/skills/binlog-failure-analysis/SKILL.md
plugins/dotnet-msbuild/skills/copy-to-output-directory/SKILL.md
plugins/dotnet-msbuild/skills/resolve-project-references/SKILL.md
plugins/dotnet-test-migration/skills/migrate-xunit-to-mstest/SKILL.md
plugins/dotnet-test-migration/skills/migrate-xunit-to-xunit-v3/SKILL.md
plugins/dotnet-test/skills/code-testing-extensions/SKILL.md
plugins/dotnet-test/skills/filter-syntax/SKILL.md
plugins/dotnet-test/skills/find-untested-sources/SKILL.md
plugins/dotnet-test/skills/platform-detection/SKILL.md
plugins/dotnet-upgrade/skills/dotnet-aot-compat/SKILL.md
.agents/skills/authoring-github-workflows/SKILL.md
plugins/dotnet-advanced/skills/dotnet-pinvoke/SKILL.md
plugins/dotnet-ai/skills/mcp-csharp-create/SKILL.md
plugins/dotnet-ai/skills/mcp-csharp-debug/SKILL.md
plugins/dotnet-ai/skills/mcp-csharp-test/SKILL.md
plugins/dotnet-ai/skills/technology-selection/SKILL.md
plugins/dotnet-aspnetcore/skills/convert-blazor-server-to-webapp/SKILL.md
plugins/dotnet-blazor/skills/author-component/SKILL.md
plugins/dotnet-blazor/skills/collect-user-input/SKILL.md
plugins/dotnet-blazor/skills/configure-auth/SKILL.md
plugins/dotnet-blazor/skills/coordinate-components/SKILL.md
plugins/dotnet-blazor/skills/plan-ui-change/SKILL.md
plugins/dotnet-data/skills/create-datadriven-aspnetcore/SKILL.md
plugins/dotnet-diag/skills/android-tombstone-symbolication/SKILL.md
plugins/dotnet-diag/skills/apple-crash-symbolication/SKILL.md
plugins/dotnet-diag/skills/microbenchmarking/SKILL.md
plugins/dotnet-experimental/skills/exp-test-maintainability/SKILL.md

Metadata

Files
0
Version
2124a6e
Hash
4b2d14f7
Indexed
2026-07-06 00:31

trang chủ - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-04 20:17
浙ICP备14020137号-1 $bản đồ khách truy cập$