I want to install VS Build Tool 2022 with the following components:
- .NET Desktop Build Tools
- Exclude .Net Framework 4.8 targeting pack
- Web development Build Tools
- Node.js Build Tools
- Include optional
I do not know currently how to exclude the .Net Framework 4.8 targeting pack, but I thought I understood how to do the rest and here is the script I created based on the information in 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
Unfortunately, it only installs the bare minimum. The rest I have to do manually through the VS Installer.
So my script must be wrong, but where is the problem?
CodePudding user response:
To pass the arguments down to the vs_buildtools.exe installer you need to include the --params
option.
choco install visualstudio2022buildtools -y --params $InstallerArgs