From 4022357d550d0a7b64bbd4334f5852e93e30f2a1 Mon Sep 17 00:00:00 2001 From: JoYo Date: Fri, 27 Sep 2019 16:55:39 +0000 Subject: [PATCH] Add 'msvc_buildtools.ps1' installation script for msvc 2019. change the 16 to 15 for msvc 2017. --- msvc_buildtools.ps1 | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 msvc_buildtools.ps1 diff --git a/msvc_buildtools.ps1 b/msvc_buildtools.ps1 new file mode 100644 index 0000000..df503e0 --- /dev/null +++ b/msvc_buildtools.ps1 @@ -0,0 +1,23 @@ +New-Item "temp" -ItemType "directory" -Force +$client = New-Object System.Net.WebClient +$client.DownloadFile("https://aka.ms/vs/16/release/channel", "temp\visualstudio.release.chman") +$client.DownloadFile("https://aka.ms/vs/16/release/vs_buildtools.exe", "temp\vs_buildtools.exe") + +$args = @("--passive", "--wait", "--norestart", +"--channelUri", ($pwd.path + "\temp\visualstudio.release.chman"), +"--installChannelUri", ($pwd.path + "\temp\visualstudio.release.chman"), +"--add", "Microsoft.VisualStudio.Workload.VCTools", "--includeRecommended", +"--installPath", "C:\msvc") +Start-Process "temp\vs_buildtools.exe" -ArgumentList $args -Wait + +$path = [System.Environment]::GetEnvironmentVariable("PATH", "User") +$cmake = "C:\msvc\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin;" +if(-not $path.Contains($cmake)){ + [Environment]::SetEnvironmentVariable("PATH", $path + $cmake, "User") +} + +$path = [System.Environment]::GetEnvironmentVariable("PATH", "User") +$msbuild = "C:\msvc\MSBuild\Current\Bin;" +if(-not $path.Contains($msbuild)){ + [Environment]::SetEnvironmentVariable("PATH", $path + $msbuild, "User") +} \ No newline at end of file