Last active
March 4, 2020 19:09
-
-
Save bradwilson/29c039548c1cb80ca8d0 to your computer and use it in GitHub Desktop.
Add VS 2015 build tools to your path
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| param( | |
| [Parameter(Mandatory=$true)][string]$pathToBeAdded | |
| ) | |
| $local:oldPath = get-content Env:\Path | |
| $local:newPath = $local:oldPath + ";" + $pathToBeAdded | |
| set-content Env:\Path $local:newPath |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| param( | |
| [Parameter(Position=0, Mandatory=$true, ValueFromPipeline=$true)][string] $Script, | |
| [Parameter(Position=1, Mandatory=$false)][string] $Parameters | |
| ) | |
| $tempFile = [IO.Path]::GetTempFileName() | |
| cmd /c " `"$script`" $parameters && set > `"$tempFile`" " | |
| Get-Content $tempFile | %{ | |
| if ($_ -match "^(.*?)=(.*)$") { | |
| Set-Content "env:\$($matches[1])" $matches[2] | |
| } | |
| } | |
| Remove-Item $tempFile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| param( | |
| [switch]$noWebTools | |
| ) | |
| if (test-path Env:\VS140COMNTOOLS) { | |
| $vsvars32 = [System.IO.Path]::GetFullPath((join-path (get-content Env:\VS140COMNTOOLS) "vsvars32.bat")) | |
| if (test-path $vsvars32) { | |
| write-host "Setting environment for Microsoft Visual Studio 2015." | |
| invoke-cmdscript $vsvars32 | |
| if ($noWebTools -eq $false) { | |
| $webTools = [System.IO.Path]::GetFullPath((join-path (get-content Env:\VS140COMNTOOLS) "..\IDE\Extensions\Microsoft\Web Tools\External")) | |
| if (test-path $webTools) { | |
| write-host "Adding Web Tools external tools to the PATH." | |
| append-path $webTools | |
| } | |
| } | |
| } | |
| else { | |
| write-warning ("Cannot find " + $vsvars32) | |
| } | |
| } | |
| else { | |
| write-warning "Visual Studio 2015 is not installed." | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment