2023-08-20 19:39:46 -07:00
|
|
|
if ($env:VCINSTALLDIR) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2023-07-30 15:55:57 -07:00
|
|
|
$ErrorActionPreference = "Stop"
|
2023-07-27 14:12:58 -07:00
|
|
|
|
2023-07-30 15:55:57 -07:00
|
|
|
# Use vswhere to find the latest Visual Studio installation
|
|
|
|
$vswhere_out = & "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath
|
|
|
|
if ($null -eq $vswhere_out) {
|
|
|
|
Write-Host "ERROR: Visual Studio installation not found"
|
|
|
|
exit 1
|
2023-07-27 14:12:58 -07:00
|
|
|
}
|
|
|
|
|
2023-07-30 15:55:57 -07:00
|
|
|
# Find Launch-VsDevShell.ps1 in the Visual Studio installation
|
|
|
|
$vs_path = $vswhere_out
|
|
|
|
$vs_devshell = Join-Path $vs_path "\Common7\Tools\Launch-VsDevShell.ps1"
|
2023-07-27 14:12:58 -07:00
|
|
|
|
2023-07-30 15:55:57 -07:00
|
|
|
if ( -not (Test-Path $vs_devshell) ) {
|
|
|
|
Write-Host "ERROR: Launch-VsDevShell.ps1 not found in Visual Studio installation"
|
|
|
|
Write-Host Tested path: $vs_devshell
|
|
|
|
exit 1
|
2023-07-27 14:12:58 -07:00
|
|
|
}
|
|
|
|
|
2023-07-30 15:55:57 -07:00
|
|
|
# Launch the Visual Studio Developer Shell
|
|
|
|
Push-Location
|
2023-08-19 18:33:01 -07:00
|
|
|
& $vs_devshell @args
|
2023-08-20 09:31:24 -07:00
|
|
|
Pop-Location
|