重要前提
安装AI Skills的关键前提是:必须科学上网,且开启TUN模式,这一点至关重要,直接决定安装能否顺利完成,在此郑重提醒三遍:科学上网,科学上网,科学上网。查看完整安装教程 →
npx skills add https://github.com/dotnet/skills --skill build-perf-diagnostics生成 binlog:dotnet build /bl:{} -m
重放并生成包含性能摘要的诊断日志:
dotnet msbuild build.binlog -noconlog -fl -flp:v=diag;logfile=full.log;performancesummary
读取性能摘要(位于 full.log 末尾):
grep "Target Performance Summary\|Task Performance Summary" -A 50 full.log
查找耗时的目标和任务:PerformanceSummary 部分列出了按累计时间排序的所有目标/任务
检查节点利用率:搜索调度和节点相关的消息
grep -i "node.*assigned\|building with\|scheduler" full.log | head -30
:搜索分析器耗时消息
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
grep -i "analyzer.*elapsed\|Total analyzer execution time\|CompilerAnalyzerDriver" full.log
<DesignTimeBuild>false</DesignTimeBuild>,为诊断设置 <ResolveAssemblyReferencesSilent>true</ResolveAssemblyReferencesSilent><DesignTimeBuild> 和 <ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch><DisableTransitiveProjectReferences>true</DisableTransitiveProjectReferences> 以避免引入完整的传递闭包(注意:项目可能需要为其使用的任何类型添加直接引用)。对于仅在构建时(而非 API 层面)需要的 ProjectReferences,使用 ReferenceOutputAssembly="false"。修剪未使用的 PackageReferences。/p:RunAnalyzers=false)时的 Csc 持续时间<RunAnalyzers Condition="'$(ContinuousIntegrationBuild)' != 'true'">false</RunAnalyzers><RunAnalyzers Condition="'$(Configuration)' == 'Debug'">false</RunAnalyzers><EnforceCodeStyleInBuild Condition="'$(ContinuousIntegrationBuild)' == 'true'">true</EnforceCodeStyleInBuild>Directory.Packages.props 中的 GlobalPackageReference 添加的分析器适用于所有项目。考虑测试项目是否需要与生产代码相同的分析器集。Directory.Build.props 中设置为 true 时,会强制在每次构建时进行代码风格分析。应基于 CI 环境(ContinuousIntegrationBuild)有条件地设置,以避免拖慢开发内部循环。BuildInParallel<CreateHardLinksForCopyFilesToOutputDirectoryIfPossible>true</CreateHardLinksForCopyFilesToOutputDirectoryIfPossible>),减少 CopyToOutputDirectory 项,适当时使用 <UseCommonOutputDirectory>true</UseCommonOutputDirectory>,设置 <SkipCopyUnchangedFiles>true</SkipCopyUnchangedFiles>,考虑使用 --artifacts-path (.NET 8+) 进行集中输出布局<EnableDefaultItems>false</EnableDefaultItems>,尽可能避免基于 NuGet 的 SDK 解析器eval-performance skill 获取详细指导dotnet restore,然后 dotnet build --no-restore<RestoreUseStaticGraphEvaluation>true</RestoreUseStaticGraphEvaluation> —— 在大型构建中可以节省大量时间(效果取决于工作负载)/graph 模式以获得更好的调度使用文本日志重放的逐步工作流程:
重放并生成性能摘要:
dotnet msbuild build.binlog -noconlog -fl -flp:v=diag;logfile=full.log;performancesummary
读取目标/任务性能摘要(位于 full.log 末尾):
grep "Target Performance Summary\|Task Performance Summary" -A 50 full.log
这显示了按累计时间排序的所有目标和任务——相当于查找耗时的目标/任务。 3. 查找每个项目的构建时间:
grep "done building project\|Project Performance Summary" full.log
4. 检查并行性(多节点调度):
grep -i "node.*assigned\|RequiresLeadingNewline\|Building with" full.log | head -30
5. 检查分析器开销:
grep -i "Total analyzer execution time\|analyzer.*elapsed\|CompilerAnalyzerDriver" full.log
6. 深入调查特定的缓慢目标:
grep 'Target "CoreCompile"\|Target "ResolveAssemblyReferences"' full.log
/maxcpucount(或 -m)进行并行构建dotnet restore,然后 dotnet build --no-restore)<RestoreUseStaticGraphEvaluation>true</RestoreUseStaticGraphEvaluation>)<CreateHardLinksForCopyFilesToOutputDirectoryIfPossible>true</CreateHardLinksForCopyFilesToOutputDirectoryIfPossible>)<RunAnalyzers Condition="'$(ContinuousIntegrationBuild)' != 'true'">false</RunAnalyzers><ProduceReferenceAssembly>true</ProduceReferenceAssembly>)incremental-build skill)check-bin-obj-clash skill)/graph)--artifacts-path (.NET 8+) 进行集中输出布局报告发现时,按影响分类以帮助确定修复优先级:
每周安装次数
49
仓库
GitHub 星标
703
首次出现
2026年3月10日
安全审计
安装于
kimi-cli47
gemini-cli47
amp47
cline47
github-copilot47
codex47
Generate a binlog : dotnet build /bl:{} -m
Replay to diagnostic log with performance summary :
dotnet msbuild build.binlog -noconlog -fl -flp:v=diag;logfile=full.log;performancesummary
Read the performance summary (at the end of full.log):
grep "Target Performance Summary\|Task Performance Summary" -A 50 full.log
Find expensive targets and tasks : The PerformanceSummary section lists all targets/tasks sorted by cumulative time
Check for node utilization : grep for scheduling and node messages
grep -i "node.*assigned\|building with\|scheduler" full.log | head -30
Check analyzers : grep for analyzer timing
grep -i "analyzer.*elapsed\|Total analyzer execution time\|CompilerAnalyzerDriver" full.log
<DesignTimeBuild>false</DesignTimeBuild> for RAR-heavy analysis, set <ResolveAssemblyReferencesSilent>true</ResolveAssemblyReferencesSilent> for diagnostic<DesignTimeBuild> and <ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch><DisableTransitiveProjectReferences>true</DisableTransitiveProjectReferences> to avoid pulling in the full transitive closure (note: projects may need to add direct references for any types they consume). Use ReferenceOutputAssembly="false" on ProjectReferences that are only needed at build time (not API surface). Trim unused PackageReferences./p:RunAnalyzers=false)<RunAnalyzers Condition="'$(ContinuousIntegrationBuild)' != 'true'">false</RunAnalyzers><RunAnalyzers Condition="'$(Configuration)' == 'Debug'">false</RunAnalyzers><EnforceCodeStyleInBuild Condition="'$(ContinuousIntegrationBuild)' == 'true'">true</EnforceCodeStyleInBuild>GlobalPackageReference in apply to ALL projects. Consider if test projects need the same analyzer set as production code.BuildInParallel<CreateHardLinksForCopyFilesToOutputDirectoryIfPossible>true</CreateHardLinksForCopyFilesToOutputDirectoryIfPossible>), reduce CopyToOutputDirectory items, use <UseCommonOutputDirectory>true</UseCommonOutputDirectory> when appropriate, set <SkipCopyUnchangedFiles>true</SkipCopyUnchangedFiles>, consider --artifacts-path (.NET 8+) for centralized output layout<EnableDefaultItems>false</EnableDefaultItems> for legacy projects with explicit file lists, avoid NuGet-based SDK resolvers if possibleeval-performance skill for detailed guidancedotnet restore then dotnet build --no-restore<RestoreUseStaticGraphEvaluation>true</RestoreUseStaticGraphEvaluation> in Directory.Build.props — can save significant time in large builds (results are workload-dependent)/graph mode for better schedulingStep-by-step workflow using text log replay:
Replay with performance summary :
dotnet msbuild build.binlog -noconlog -fl -flp:v=diag;logfile=full.log;performancesummary
Read target/task performance summaries (at the end of full.log):
grep "Target Performance Summary\|Task Performance Summary" -A 50 full.log
This shows all targets and tasks sorted by cumulative time — equivalent to finding expensive targets/tasks. 3. Find per-project build times :
grep "done building project\|Project Performance Summary" full.log
4. Check parallelism (multi-node scheduling):
grep -i "node.*assigned\|RequiresLeadingNewline\|Building with" full.log | head -30
5. Check analyzer overhead :
grep -i "Total analyzer execution time\|analyzer.*elapsed\|CompilerAnalyzerDriver" full.log
6. Drill into a specific slow target :
grep 'Target "CoreCompile"\|Target "ResolveAssemblyReferences"' full.log
/maxcpucount (or -m) for parallel buildsdotnet restore then dotnet build --no-restore)<RestoreUseStaticGraphEvaluation>true</RestoreUseStaticGraphEvaluation>)<CreateHardLinksForCopyFilesToOutputDirectoryIfPossible>true</CreateHardLinksForCopyFilesToOutputDirectoryIfPossible>)<RunAnalyzers Condition="'$(ContinuousIntegrationBuild)' != 'true'">false</RunAnalyzers><ProduceReferenceAssembly>true</ProduceReferenceAssembly>)When reporting findings, categorize by impact to help prioritize fixes:
Weekly Installs
49
Repository
GitHub Stars
703
First Seen
Mar 10, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
kimi-cli47
gemini-cli47
amp47
cline47
github-copilot47
codex47
TanStack Query v5 完全指南:React 数据管理、乐观更新、离线支持
2,500 周安装
Directory.Packages.propstrue in Directory.Build.props, forces code-style analysis on every build. Should be conditional on CI environment (ContinuousIntegrationBuild) to avoid slowing dev inner loop.incremental-build skill)check-bin-obj-clash skill)/graph) for multi-project solutions--artifacts-path (.NET 8+) for centralized output layout