Skip to content

Commit

Permalink
ci: Avoid toolset ambiguity that MSVC can't handle
Browse files Browse the repository at this point in the history
This change is required to work with the new windows-2022 image version
20231115 properly.
  • Loading branch information
hebasto committed Nov 17, 2023
1 parent 98b0acd commit e990e85
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,37 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Fix Visual Studio installation
# Avoid toolset ambiguity that MSVC can't handle.
run: |
Set-Location "C:\Program Files (x86)\Microsoft Visual Studio\Installer\"
$InstallPath = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise"
$componentsToRemove= @(
"Microsoft.VisualStudio.Component.VC.14.29.16.11.ARM"
"Microsoft.VisualStudio.Component.VC.14.29.16.11.ARM.Spectre"
"Microsoft.VisualStudio.Component.VC.14.29.16.11.ARM64"
"Microsoft.VisualStudio.Component.VC.14.29.16.11.ARM64.Spectre"
"Microsoft.VisualStudio.Component.VC.14.29.16.11.x86.x64"
"Microsoft.VisualStudio.Component.VC.14.29.16.11.x86.x64.Spectre"
"Microsoft.VisualStudio.Component.VC.14.29.16.11.ATL"
"Microsoft.VisualStudio.Component.VC.14.29.16.11.ATL.Spectre"
"Microsoft.VisualStudio.Component.VC.14.29.16.11.ATL.ARM"
"Microsoft.VisualStudio.Component.VC.14.29.16.11.ATL.ARM.Spectre"
"Microsoft.VisualStudio.Component.VC.14.29.16.11.ATL.ARM64"
"Microsoft.VisualStudio.Component.VC.14.29.16.11.ATL.ARM64.Spectre"
"Microsoft.VisualStudio.Component.VC.14.29.16.11.MFC"
"Microsoft.VisualStudio.Component.VC.14.29.16.11.MFC.Spectre"
"Microsoft.VisualStudio.Component.VC.14.29.16.11.MFC.ARM"
"Microsoft.VisualStudio.Component.VC.14.29.16.11.MFC.ARM.Spectre"
"Microsoft.VisualStudio.Component.VC.14.29.16.11.MFC.ARM64"
"Microsoft.VisualStudio.Component.VC.14.29.16.11.MFC.ARM64.Spectre"
)
[string]$workloadArgs = $componentsToRemove | ForEach-Object {" --remove " + $_}
$Arguments = ('/c', "vs_installer.exe", 'modify', '--installPath', "`"$InstallPath`"",$workloadArgs, '--quiet', '--norestart', '--nocache')
# should be run twice
$process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden
$process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden
- name: Configure Developer Command Prompt for Microsoft Visual C++
# Using microsoft/setup-msbuild is not enough.
uses: ilammy/msvc-dev-cmd@v1
Expand Down

0 comments on commit e990e85

Please sign in to comment.