Skip to content

Find VSIXInstaller

Heath Stewart edited this page Mar 6, 2020 · 1 revision

If you want to find VSIXInstaller.exe to install extensions, you only need to get the enginePath property for any instance because it will resolve to the same place. Do not store this location, however, since the path to VSIXInstaller.exe could one day change.

Batch

You could put the following into a batch file, or use the content as an example for use in any script.

@echo off

for /f "usebackq delims=" %%i in (`vswhere -latest -prerelease -products * -property enginePath`) do (
  set enginePath=%%i
)

if exist "%enginePath%\VSIXInstaller.exe" (
  call "%enginePath%\VSIXInstaller.exe" %*
)

PowerShell

You can declare a helper function like below, or just use the body of the function as an example for use in any script.

function Invoke-VSIXInstaller {
  $ErrorActionPreference = 'Stop'

  $path = vswhere -latest -prerelease -products * -property enginePath | Join-Path -ChildPath 'VSIXInstaller.exe'

  if (Test-Path $path) {
    & $path $args
  }
}