【问题标题】:Problems installing MS Build Tool updates via commandline通过命令行安装 MSBuild 工具更新时出现问题
【发布时间】:2022-10-14 22:45:18
【问题描述】:

我正在使用 powershell 尝试在我们的构建代理上为 Visual Studio 2022 构建工具自动更新/安装一些构建工具。在 UI 中,我需要这 3 个选项:

sql server build tools

我从我手动安装的第一台服务器导出了配置,因此我可以获得要安装的项目的 ID:

{
  "version": "1.0",
  "components": [
    "Microsoft.VisualStudio.Component.Roslyn.Compiler",
    "Microsoft.Component.MSBuild",
    "Microsoft.VisualStudio.Component.CoreBuildTools",
    "Microsoft.VisualStudio.Workload.MSBuildTools",
    "Microsoft.Net.Component.4.7.2.TargetingPack",
    "Microsoft.Net.Component.4.8.TargetingPack",
    "Microsoft.VisualStudio.Component.SQL.SSDTBuildSku"
  ]
}

我使用底部的 3 个 sku 创建脚本来尝试安装它:

$components =@(
    "Microsoft.Net.Component.4.7.2.TargetingPack",
    "Microsoft.Net.Component.4.8.TargetingPack",
    "Microsoft.VisualStudio.Component.SQL.SSDTBuildSku")
 $components | %{Start-Process "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe" -ArgumentList 'modify --installPath "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools" --passive --add $_' -Wait -PassThru}

我知道这会提示通过 UI 重新启动,但我已经在安装后重新启动它并没有显示这些已安装。除了这个输出,我没有得到任何确认它是成功还是失败,尽管我确实看到 UI 短暂弹出,因为我没有指定静默:

script output

我做错了什么?

【问题讨论】:

    标签: visual-studio powershell


    【解决方案1】:
    【解决方案2】:
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-05-20
    • 1970-01-01
    • 2021-06-14
    • 2016-08-27
    • 2013-07-20
    • 2013-10-04
    相关资源
    最近更新 更多