bahrep
bahrep

Reputation: 30662

How to find out which Visual Studio extensions are installed on user's machines?

How to find out which Visual Studio extensions are installed on user's machines?

I want to track which VS extensions are installed on users' computers in AD environment. I think that's easy when an extension installs via Windows Installer (*.msi). But what about VSIX extensions (vsixinstaller.exe)?

Upvotes: 2

Views: 2448

Answers (2)

Ed Dore
Ed Dore

Reputation: 2109

I suspect the IVsExtensionManager.GetInstalledExtensions API is what you're looking for.

Also, Mad's published an open source "Extension Manager 2019" extension, that implements an export/import extensions command, which you might find as a useful example.

The source for the extension can be found in the following github repo:

ExtensionPackTools

Sincerely

Upvotes: 1

dxiv
dxiv

Reputation: 17638

There is no direct way that I am aware of to list all installed VSIX extensions, but vsixInstaller has an option to generate a logfile which identifies the extension.vsixmanifest files it locates, and each such file is an XML that contains the relevant details about the extension (name, version etc).

To have vsixInstaller generate the logfile, pretend to uninstall an extension that does not exist. This may take a while, especially if multiple versions of VS are installed (the following must go all on one line).

C:\Program Files (x86)\Microsoft Visual Studio\Installer\resources\
   app\ServiceHub\Services\Microsoft.VisualStudio.Setup.Service>
   vsixInstaller /logFile:vsix.log /appIdName:VS /uninstall:nosuchxt

The generated logfile will then be %TEMP%\vsix.log and the Found lines point to the extensions that vsixInstaller located, for example (with root paths replaced by %VS20xx%):

vsixinstaller.exe version:
16.5.2047
...
BEGIN: Processing extension pack
...
Found '%ProgramFiles(x86)%\COMMON FILES\MICROSOFT\EXTENSIONMANAGER\EXTENSIONS\Microsoft\Windows Kits\10\Desktop SDK\extension.vsixmanifest'
...
Found '%VS2015%\COMMON7\IDE\EXTENSIONS\VSSDK\extension.vsixmanifest'
...
Found '%VS2019%\COMMON7\IDE\EXTENSIONS\VSSDK\extension.vsixmanifest'
...
END: Processing extension pack

Each extension.vsixmanifest file referenced in the list begins with a metadata node that identifies the name and version of the respective extension, for example:

<Metadata>
  <Identity Id="Microsoft.VisualStudio.SDK" 
            Version="16.0"
            Language="en-US"
            Publisher="Microsoft Corporation" />
  <DisplayName>Microsoft Visual Studio SDK</DisplayName>
  <Description>Tools for building Visual Studio extensions</Description>
</Metadata>

With some (not entirely trivial) plumbing work, this could all be automated in a script/batch job.

Upvotes: 2

Related Questions