File: enter_vs_dev_shell.ps1

package info (click to toggle)
colmap 3.10-2.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 11,168 kB
  • sloc: cpp: 91,779; ansic: 17,774; python: 3,459; sh: 216; makefile: 154
file content (25 lines) | stat: -rw-r--r-- 835 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
if (!$env:VisualStudioDevShell) {
    $vswhere = "${Env:ProgramFiles(x86)}/Microsoft Visual Studio/Installer/vswhere.exe"
    if (!(Test-Path $vswhere)) {
        throw "Failed to find vswhere.exe"
    }

    & $vswhere -latest -format json
    $vsInstance = & $vswhere -latest -format json | ConvertFrom-Json 
    if ($LASTEXITCODE) {
        throw "vswhere.exe returned exit code $LASTEXITCODE"
    }

    Import-Module "$($vsInstance.installationPath)/Common7/Tools/Microsoft.VisualStudio.DevShell.dll"
    $prevCwd = Get-Location
    try {
        Enter-VsDevShell $vsInstance.instanceId -DevCmdArguments "-no_logo -host_arch=amd64 -arch=amd64"
    } catch {
        Write-Host $_
        Write-Error "Failed to enter Visual Studio Dev Shell"
        exit 1
    }
    Set-Location $prevCwd

    $env:VisualStudioDevShell = $true
}