Skip to content

Commit efe042b

Browse files
authoredJul 14, 2024
Update build-windows.yml
Use MSVC Toolset (v14.36-17.6) components
1 parent 8a0f920 commit efe042b

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
 

‎.github/workflows/build-windows.yml

+32
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,38 @@ jobs:
1919

2020
- uses: SpecialKO/GA-setup-cpp-n20@master
2121

22+
- name: Uninstall MSVC Toolset (latest) components
23+
run: |
24+
Set-Location "C:\Program Files (x86)\Microsoft Visual Studio\Installer\"
25+
$InstallPath = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise"
26+
$componentsToRemove= @(
27+
"Microsoft.VisualStudio.Component.VC.ATL"
28+
"Microsoft.VisualStudio.Component.VC.ATLMFC"
29+
"Microsoft.VisualStudio.Component.VC.Tools.x86.x64"
30+
"Microsoft.VisualStudio.Component.VC.CLI.Support"
31+
)
32+
[string]$workloadArgs = $componentsToRemove | ForEach-Object {" --remove " + $_}
33+
$Arguments = ('/c', "vs_installer.exe", 'modify', '--installPath', "`"$InstallPath`"",$workloadArgs, '--quiet', '--norestart', '--nocache')
34+
# should be run twice
35+
$process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden
36+
$process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden
37+
38+
- name: Install MSVC Toolset (v14.36-17.6) components
39+
run: |
40+
Set-Location "C:\Program Files (x86)\Microsoft Visual Studio\Installer\"
41+
$InstallPath = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise"
42+
$componentsToRemove= @(
43+
"Microsoft.VisualStudio.Component.VC.14.36.17.6.ATL"
44+
"Microsoft.VisualStudio.Component.VC.14.36.17.6.MFC"
45+
"Microsoft.VisualStudio.Component.VC.14.36.17.6.x86.x64"
46+
"Microsoft.VisualStudio.Component.VC.14.36.17.6.CLI.Support"
47+
)
48+
[string]$workloadArgs = $componentsToRemove | ForEach-Object {" --add " + $_}
49+
$Arguments = ('/c', "vs_installer.exe", 'modify', '--installPath', "`"$InstallPath`"",$workloadArgs, '--quiet', '--norestart', '--nocache')
50+
# should be run twice
51+
$process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden
52+
$process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden
53+
2254
- uses: microsoft/setup-msbuild@v2
2355
with:
2456
vs-version: '[17.0,18.0)'

0 commit comments

Comments
 (0)
Please sign in to comment.