vs2019_install.ps1 1.18 KB
Newer Older
1
$VS_DOWNLOAD_LINK = "https://aka.ms/vs/16/release/vs_buildtools.exe"
2
3
4
$VS_INSTALL_ARGS = @("--nocache","--quiet","--wait", "--add Microsoft.VisualStudio.Workload.VCTools",
                                                     "--add Microsoft.Component.MSBuild",
                                                     "--add Microsoft.VisualStudio.Component.Roslyn.Compiler",
5
                                                     "--add Microsoft.VisualStudio.Component.VC.CoreBuildTools",
6
                                                     "--add Microsoft.VisualStudio.Component.VC.Redist.14.Latest",
7
                                                     "--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64")
8
9
10

curl.exe --retry 3 -kL $VS_DOWNLOAD_LINK --output vs_installer.exe
if ($LASTEXITCODE -ne 0) {
11
    echo "Download of the VS 2019 installer failed"
12
13
14
15
16
17
18
    exit 1
}

$process = Start-Process "${PWD}\vs_installer.exe" -ArgumentList $VS_INSTALL_ARGS -NoNewWindow -Wait -PassThru
Remove-Item -Path vs_installer.exe -Force
$exitCode = $process.ExitCode
if (($exitCode -ne 0) -and ($exitCode -ne 3010)) {
19
    echo "VS 2019 installer exited with code $exitCode, which should be one of [0, 3010]."
20
21
    exit 1
}