1
1
# https://developercommunity.visualstudio.com/t/install-specific-version-of-vs-component/1142479
2
- # Where to find the links: https://docs.microsoft.com/en-us/visualstudio/releases/2019/history#release-dates-and-build-numbers
3
-
2
+ # Where to find the links:
3
+ # - https://docs.microsoft.com/en-us/visualstudio/releases/2019/history#release-dates-and-build-numbers
4
+ # - https://learn.microsoft.com/en-us/visualstudio/releases/2022/release-history#fixed-version-bootstrappers
4
5
# BuildTools from S3
5
- $VS_DOWNLOAD_LINK = " https://s3.amazonaws.com/ossci-windows/vs${env: VS_VERSION} _BuildTools.exe"
6
+ $VS_VERSION_major = [int ] ${env: VS_VERSION}.split (" ." )[0 ]
7
+ $VS_DOWNLOAD_LINK = " https://aka.ms/vs/$VS_VERSION_major /release/vs_BuildTools.exe"
6
8
$COLLECT_DOWNLOAD_LINK = " https://aka.ms/vscollect.exe"
7
9
$VS_INSTALL_ARGS = @ (" --nocache" , " --quiet" , " --wait" , " --add Microsoft.VisualStudio.Workload.VCTools" ,
8
10
" --add Microsoft.Component.MSBuild" ,
@@ -19,19 +21,18 @@ if (${env:INSTALL_WINDOWS_SDK} -eq "1") {
19
21
}
20
22
21
23
if (Test-Path " ${env: ProgramFiles(x86)} \Microsoft Visual Studio\Installer\vswhere.exe" ) {
22
- $VS_VERSION_major = [int ] ${env: VS_VERSION}.split (" ." )[0 ]
23
- $existingPath = & " ${env: ProgramFiles(x86)} \Microsoft Visual Studio\Installer\vswhere.exe" - products " Microsoft.VisualStudio.Product.BuildTools" - version " [${env: VS_VERSION} , ${env: VS_VERSION_major + 1} )" - property installationPath
24
+ $existingPath = & " ${env: ProgramFiles(x86)} \Microsoft Visual Studio\Installer\vswhere.exe" - products " Microsoft.VisualStudio.Product.BuildTools" - version " [${env: VS_VERSION} , ${VS_VERSION_major + 1} )" - property installationPath
24
25
if (($existingPath -ne $null ) -and (! ${env: CIRCLECI} )) {
25
26
echo " Found correctly versioned existing BuildTools installation in $existingPath "
26
27
exit 0
27
28
}
28
29
$pathToRemove = & " ${env: ProgramFiles(x86)} \Microsoft Visual Studio\Installer\vswhere.exe" - products " Microsoft.VisualStudio.Product.BuildTools" - property installationPath
29
30
}
30
31
31
- echo " Downloading VS installer from S3 ."
32
+ echo " Downloading Visual Studio installer from $VS_DOWNLOAD_LINK ."
32
33
curl.exe -- retry 3 - kL $VS_DOWNLOAD_LINK -- output vs_installer.exe
33
34
if ($LASTEXITCODE -ne 0 ) {
34
- echo " Download of the VS 2019 Version ${env: VS_VERSION} installer failed"
35
+ echo " Download of the VS ${ env: VS_YEAR} Version ${env: VS_VERSION} installer failed"
35
36
exit 1
36
37
}
37
38
@@ -52,7 +53,7 @@ $process = Start-Process "${PWD}\vs_installer.exe" -ArgumentList $VS_INSTALL_ARG
52
53
Remove-Item - Path vs_installer.exe - Force
53
54
$exitCode = $process.ExitCode
54
55
if (($exitCode -ne 0 ) -and ($exitCode -ne 3010 )) {
55
- echo " VS 2019 installer exited with code $exitCode , which should be one of [0, 3010]."
56
+ echo " VS ${ env: VS_YEAR} installer exited with code $exitCode , which should be one of [0, 3010]."
56
57
curl.exe -- retry 3 - kL $COLLECT_DOWNLOAD_LINK -- output Collect.exe
57
58
if ($LASTEXITCODE -ne 0 ) {
58
59
echo " Download of the VS Collect tool failed."
0 commit comments