1 # we want more secure TLS 1.2 for most things 2 [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; 3 4 # VS16.x is 2019 5 $msvc_2019_url = 'https://aka.ms/vs/16/release/vs_buildtools.exe' 6 7 Get-Date 8 Write-Host "Downloading Visual Studio 2019 build tools" 9 Invoke-WebRequest -Uri $msvc_2019_url -OutFile C:\vs_buildtools.exe 10 11 Get-Date 12 Write-Host "Installing Visual Studio 2019" 13 # Command line 14 # https://docs.microsoft.com/en-us/visualstudio/install/command-line-parameter-examples?view=vs-2019 15 # Component ids 16 # https://docs.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-build-tools?view=vs-2019 17 # https://docs.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-community?view=vs-2019 18 Start-Process -NoNewWindow -Wait -FilePath C:\vs_buildtools.exe ` 19 -ArgumentList ` 20 "--wait", ` 21 "--quiet", ` 22 "--norestart", ` 23 "--nocache", ` 24 "--installPath", "C:\BuildTools", ` 25 "--add", "Microsoft.VisualStudio.Component.VC.ASAN", ` 26 "--add", "Microsoft.VisualStudio.Component.VC.Redist.14.Latest", ` 27 "--add", "Microsoft.VisualStudio.Component.VC.ATL", ` 28 "--add", "Microsoft.VisualStudio.Component.VC.ATLMFC", ` 29 "--add", "Microsoft.VisualStudio.Component.VC.Tools.x86.x64", ` 30 "--add", "Microsoft.VisualStudio.Component.Graphics.Tools", ` 31 "--add", "Microsoft.VisualStudio.Component.Windows10SDK.20348" 32 33 if (!$?) { 34 Write-Host "Failed to install Visual Studio tools" 35 Exit 1 36 } 37 Remove-Item C:\vs_buildtools.exe -Force 38 Get-Date 39