diff --git a/Workloads/rust/configuration.winget b/Workloads/rust/configuration.winget index 20796d8..0c9d57c 100644 --- a/Workloads/rust/configuration.winget +++ b/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: