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