Skip to content

Commit c64e7d0

Browse files
authored
PHPC-2388: Simplify steps for VC15 installation (#1567)
1 parent 69d4a72 commit c64e7d0

File tree

1 file changed

+6
-26
lines changed

1 file changed

+6
-26
lines changed

.github/actions/windows/prepare-build/action.yml

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -17,37 +17,17 @@ outputs:
1717
runs:
1818
using: composite
1919
steps:
20-
# Reinstall VC15 (Visual Studio 2017) for PHP 7.4 using the suggested script
21-
# from https://github.com/actions/runner-images/issues/9701
22-
- name: Remove VC15 component for PHP 7.4
23-
if: ${{ inputs.version == '7.4' }}
24-
shell: pwsh
25-
run: |
26-
Set-Location "C:\Program Files (x86)\Microsoft Visual Studio\Installer\"
27-
$InstallPath = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise"
28-
$componentsToRemove= @(
29-
"Microsoft.VisualStudio.Component.VC.v141.x86.x64"
30-
)
31-
[string]$workloadArgs = $componentsToRemove | ForEach-Object {" --remove " + $_}
32-
$Arguments = ('/c', "vs_installer.exe", 'modify', '--installPath', "`"$InstallPath`"",$workloadArgs, '--quiet', '--norestart', '--nocache')
33-
# should be run twice
34-
$process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden
35-
$process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden
36-
20+
# Reinstall VC15 (Visual Studio 2017) for PHP 7.4 using a derivation of the
21+
# script suggested in https://github.com/actions/runner-images/issues/9701
3722
- name: Install VC15 component for PHP 7.4
3823
if: ${{ inputs.version == '7.4' }}
3924
shell: pwsh
4025
run: |
4126
Set-Location "C:\Program Files (x86)\Microsoft Visual Studio\Installer\"
42-
$InstallPath = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise"
43-
$componentsToRemove= @(
44-
"Microsoft.VisualStudio.Component.VC.v141.x86.x64"
45-
)
46-
[string]$workloadArgs = $componentsToRemove | ForEach-Object {" --add " + $_}
47-
$Arguments = ('/c', "vs_installer.exe", 'modify', '--installPath', "`"$InstallPath`"",$workloadArgs, '--quiet', '--norestart', '--nocache')
48-
# should be run twice
49-
$process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden
50-
$process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden
27+
$installPath = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise"
28+
$component = "Microsoft.VisualStudio.Component.VC.v141.x86.x64"
29+
$args = ('/c', "vs_installer.exe", 'modify', '--installPath', "`"$installPath`"", '--add', $component, '--quiet', '--norestart', '--nocache')
30+
$process = Start-Process -FilePath cmd.exe -ArgumentList $args -Wait -PassThru -WindowStyle Hidden
5131
5232
- name: Setup PHP SDK
5333
id: setup-php

0 commit comments

Comments
 (0)