diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d6fb94312b198..23333674bed4b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -166,6 +166,8 @@ jobs: runs-on: windows-2022 timeout-minutes: 90 steps: + - name: Install VS2022 BuildTools 17.9.7 + run: choco install -y visualstudio2022buildtools --version=117.9.7.0 --params "--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --installChannelUri https://aka.ms/vs/17/release/180911598_-255012421/channel" - uses: KyleMayes/install-llvm-action@8b37482c5a2997a3ab5dbf6561f8109e2eaa7d3b with: version: 16.0.6 diff --git a/windows-release.ps1 b/windows-release.ps1 index 3f692f86bad80..cdbe7c9949c5f 100644 --- a/windows-release.ps1 +++ b/windows-release.ps1 @@ -10,15 +10,21 @@ $ErrorActionPreference = "Stop" # Set up MSVC environment variables. This is taken from Bun's 'scripts\env.ps1' if ($env:VSINSTALLDIR -eq $null) { Write-Host "Loading Visual Studio environment, this may take a second..." - $vsDir = Get-ChildItem -Path "C:\Program Files\Microsoft Visual Studio\2022" -Directory - if ($vsDir -eq $null) { - throw "Visual Studio directory not found." - } - Push-Location $vsDir try { - . (Join-Path -Path $vsDir.FullName -ChildPath "Common7\Tools\Launch-VsDevShell.ps1") -Arch amd64 -HostArch amd64 + Import-Module 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\Tools\Microsoft.VisualStudio.DevShell.dll' + Enter-VsDevShell -VsInstallPath 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools' -DevCmdArguments '-arch=amd64 -host_arch=amd64' + } catch { + $vsDir = Get-ChildItem -Path "C:\Program Files\Microsoft Visual Studio\2022" -Directory + if ($vsDir -eq $null) { + throw "Visual Studio directory not found." + } + Push-Location $vsDir + try { + . (Join-Path -Path $vsDir.FullName -ChildPath "Common7\Tools\Launch-VsDevShell.ps1") -Arch amd64 -HostArch amd64 + } finally { + Pop-Location + } } - finally { Pop-Location } } if ($Env:VSCMD_ARG_TGT_ARCH -eq "x86") {