1 $VS_DOWNLOAD_LINK = "https://go.microsoft.com/fwlink/?LinkId=691126" 2 $COLLECT_DOWNLOAD_LINK = "https://aka.ms/vscollect.exe" 3 curl.exe --retry 3 -kL $VS_DOWNLOAD_LINK --output vs_installer.exe 4 if ($LASTEXITCODE -ne 0) { 5 echo "Download of the VS 2015 installer failed" 6 exit 1 7 } 8 $VS_INSTALL_ARGS = @("/Quiet", "/NoRestart") 9 $process = Start-Process "${PWD}\vs_installer.exe" -ArgumentList $VS_INSTALL_ARGS -NoNewWindow -Wait -PassThru 10 Remove-Item -Path vs_installer.exe -Force 11 $exitCode = $process.ExitCode 12 if (($exitCode -ne 0) -and ($exitCode -ne 3010)) { 13 echo "VS 2015 installer exited with code $exitCode, which should be one of [0, 3010]." 14 curl.exe --retry 3 -kL $COLLECT_DOWNLOAD_LINK --output Collect.exe 15 if ($LASTEXITCODE -ne 0) { 16 echo "Download of the VS Collect tool failed." 17 exit 1 18 } 19 Start-Process "${PWD}\Collect.exe" -NoNewWindow -Wait -PassThru 20 New-Item -Path "C:\w\build-results" -ItemType "directory" -Force 21 Copy-Item -Path "C:\Users\circleci\AppData\Local\Temp\vslogs.zip" -Destination "C:\w\build-results\" 22 exit 1 23 } 24 echo "VS 2015 installed." 25