From 222a8453befd771615654be386db2ecace92ce45 Mon Sep 17 00:00:00 2001 From: AmirMS <104940545+AmelBawa-msft@users.noreply.github.com> Date: Mon, 1 Jun 2026 17:00:24 -0700 Subject: [PATCH] Add Visual Studio Build Tools installation to rust Added installation of Visual Studio 2022 Build Tools and VCTools workload. --- src/Workloads/rust/configuration.winget | 36 ++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/src/Workloads/rust/configuration.winget b/src/Workloads/rust/configuration.winget index 20796d8..f334bb5 100644 --- a/src/Workloads/rust/configuration.winget +++ b/src/Workloads/rust/configuration.winget @@ -20,10 +20,45 @@ resources: winget: securityContext: elevated + - type: Microsoft.WinGet/Package + name: VisualStudioBuildTools + properties: + id: Microsoft.VisualStudio.2022.BuildTools + source: winget + acceptAgreements: true + metadata: + description: Install Visual Studio 2022 Build Tools (host for the MSVC C++ tools that the Rust msvc toolchain links against) + winget: + securityContext: elevated + + - type: Microsoft.DSC.Transitional/RunCommandOnSet + name: VSBuildToolsVCWorkload + dependsOn: + - VisualStudioBuildTools + properties: + executable: powershell + arguments: + "0": -NoProfile + "1": -NoLogo + "2": -Command + "3": >- + $ErrorActionPreference = 'Stop'; + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; + $bootstrapper = Join-Path $env:TEMP 'vs_BuildTools.exe'; + Invoke-WebRequest -Uri 'https://aka.ms/vs/17/release/vs_BuildTools.exe' -OutFile $bootstrapper -UseBasicParsing; + $proc = Start-Process -FilePath $bootstrapper -ArgumentList @('--quiet','--wait','--norestart','--nocache','--add','Microsoft.VisualStudio.Workload.VCTools','--includeRecommended') -Wait -PassThru; + if ($proc.ExitCode -ne 0 -and $proc.ExitCode -ne 3010) { throw "vs_BuildTools.exe exited with code $($proc.ExitCode)" } + treatAsArray: true + metadata: + description: Add the VCTools (Desktop development with C++) workload by running the VS bootstrapper directly — installs link.exe and the Windows SDK required by the Rust msvc toolchain + winget: + securityContext: elevated + - type: Microsoft.DSC.Transitional/RunCommandOnSet name: InstallStableToolchain dependsOn: - Rustup + - VSBuildToolsVCWorkload properties: executable: powershell arguments: @@ -40,4 +75,3 @@ resources: treatAsArray: true metadata: description: Install and default the stable Rust toolchain via rustup -