Created
May 28, 2024 20:26
-
-
Save RefusesNames/11a97ca77d39724f1a0d30ad81db7cd1 to your computer and use it in GitHub Desktop.
This function updates paths and sets environment variables the same way a Visual Studio developer console does
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
| function Initialize-VS { | |
| $vsPath = & (Join-Path ${env:ProgramFiles(x86)} "\Microsoft Visual Studio\Installer\vswhere.exe") -property installationpath | |
| if ($vsPath -is [array]) { | |
| $last = $vsPath | Select -Last 1 | |
| Import-Module (Join-Path $last "Common7\Tools\Microsoft.VisualStudio.DevShell.dll") | |
| Enter-VsDevShell -VsInstallPath $last -SkipAutomaticLocation -DevCmdArguments '-arch=amd64 -no_logo' | |
| } else{ | |
| Import-Module (Join-Path $vsPath "Common7\Tools\Microsoft.VisualStudio.DevShell.dll") | |
| Enter-VsDevShell -VsInstallPath $vsPath -SkipAutomaticLocation -DevCmdArguments '-arch=amd64 -no_logo' | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment