@@ -54,6 +54,55 @@ strategy:
54
54
Currently, ` windows-2019` may be used for all PHP versions, although this may
55
55
change in future releases.
56
56
57
+ # ## Manually Installing Toolsets
58
+
59
+ It is possible to manually install older toolsets on `windows-2022` using an
60
+ approach suggested in [actions/runner-images#9701](https://github.com/actions/runner-images/issues/9701).
61
+ The following example installs VC15 by its
62
+ [Component ID](https://learn.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-build-tools?view=vs-2022)
63
+ to allow building PHP 7.2, 7.3, and 7.4 on a `windows-2022` image :
64
+
65
+ ` ` ` yml
66
+ run:
67
+ steps:
68
+ - name: Delete components
69
+ shell: pwsh
70
+ run: |
71
+ Set-Location "C:\P rogram Files (x86)\M icrosoft Visual Studio\I nstaller\"
72
+ $InstallPath = "C:\P rogram Files\M icrosoft Visual Studio\2 022\E nterprise"
73
+ $componentsToRemove= @(
74
+ "Microsoft.VisualStudio.Component.VC.v141.x86.x64"
75
+ )
76
+ [string]$workloadArgs = $componentsToRemove | ForEach-Object {" --remove " + $_}
77
+ $Arguments = ('/c', "vs_installer.exe", 'modify', '--installPath', "` " $InstallPath`" " ,$workloadArgs, '--quiet', '--norestart', '--nocache')
78
+ # should be run twice
79
+ $process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden
80
+ $process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden
81
+
82
+ - name: Install components
83
+ shell: pwsh
84
+ run: |
85
+ Set-Location " C:\Program Files (x86)\Microsoft Visual Studio\Installer\"
86
+ $InstallPath = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise"
87
+ $componentsToRemove= @(
88
+ " Microsoft.VisualStudio.Component.VC.v141.x86.x64"
89
+ )
90
+ [string]$workloadArgs = $componentsToRemove | ForEach-Object {" --add " + $_}
91
+ $Arguments = ('/c', "vs_installer.exe", 'modify', '--installPath', "`"$InstallPath`"",$workloadArgs, '--quiet', '--norestart', '--nocache')
92
+ # should be run twice
93
+ $process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden
94
+ $process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden
95
+ ```
96
+
97
+ These steps should be executed _ before_ invoking the ` setup-php-sdk ` action.
98
+
99
+ An [ ` if ` conditional] ( https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsif )
100
+ can also be used to limit these steps to specific PHP versions. For example:
101
+
102
+ ``` yml
103
+ if : ${{ matrix.php == '7.4' || matrix.php == '7.3' || matrix.php == '7.2' }}
104
+ ` ` `
105
+
57
106
## Outputs
58
107
59
108
- ` toolset`: the required toolset version;
0 commit comments