我想安装带有以下组件的 VS Build Tool 2022:
- .NET Desktop Build Tools
- 排除 .Net Framework 4.8 目标包
- Web 开发构建工具
- Node.js Build Tools
我目前不知道如何排除 .Net Framework 4.8 目标包,但我认为我了解如何执行其余操作,这是我根据中的信息创建的脚本https://community.chocolatey.org/packages/visualstudio2022buildtools-preview https://community.chocolatey.org/packages/visualstudio2022buildtools-preview:
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
$Components = @(
"Microsoft.VisualStudio.Workload.ManagedDesktopBuildTools",
"Microsoft.VisualStudio.Workload.MSBuildTools",
"Microsoft.VisualStudio.Workload.NodeBuildTools;includeOptional",
"Microsoft.VisualStudio.Workload.WebBuildTools"
)
$InstallerArgs = "--add " + ($Components -join " --add ")
choco install visualstudio2022buildtools -y $InstallerArgs
不幸的是,它只安装了最低限度的内容。其余的我必须通过 VS 安装程序手动完成。
那么我的脚本肯定是错误的,但是问题出在哪里呢?
要将参数传递给 vs_buildtools.exe 安装程序,您需要包含--params
option.
choco install visualstudio2022buildtools -y --params $InstallerArgs
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)