如何在Azure构建管道中安装.NET性能诊断必备工具
无需安装完整Visual Studio获取.NET性能诊断工具的方案
通过Visual Studio Build Tools组件安装
不需要部署完整Visual Studio,仅需安装Visual Studio Build Tools的指定组件就能获取VSDiagnostics.exe等诊断工具。在构建服务器上,可通过静默命令行完成安装:vs_buildtools.exe --add Microsoft.VisualStudio.Workload.ManagedDesktopBuildTools --add Microsoft.VisualStudio.Component.DiagnosticTools --quiet该命令会安装托管桌面构建工具 workload 及诊断工具组件,包含诊断所需的全部核心工具和依赖。
手动提取诊断工具文件
若不想安装Build Tools,可从已安装对应版本Visual Studio的机器上,复制以下路径下的诊断工具目录到构建服务器:C:\Program Files (x86)\Microsoft Visual Studio\<版本号>\<Edition>\Team Tools\DiagnosticsHub\Collector
注意:这种方式需要手动同步工具版本,长期维护成本较高,不如组件安装方案稳定。使用原生.NET CLI诊断工具替代
针对内存泄漏、性能分析等需求,也可以使用无需依赖Visual Studio的.NET CLI原生工具,例如:- 内存泄漏排查:
dotnet-dump、dotnet-gcdump - 性能追踪:
dotnet-trace
这些工具可通过.NET CLI直接安装,适合构建管道自动化场景:
dotnet tool install --global dotnet-dump dotnet tool install --global dotnet-gcdump dotnet tool install --global dotnet-trace- 内存泄漏排查:
内容的提问来源于stack exchange,提问作者msedi
相关产品推荐
相关产品推荐

