Search code examples
visual-studioenvdte

How to get installed VisualStudio extensions programmatically?


How can I get a list of installed VisualStudio extensions? Somehow through DTE? Just the names would be fair enough.


Solution

  • Does this help:

    System.IServiceProvider serviceProvider = package as System.IServiceProvider;
        Microsoft.VisualStudio.ExtensionManager.IVsExtensionManager em =
           (Microsoft.VisualStudio.ExtensionManager.IVsExtensionManager)serviceProvider.GetService(
                typeof(Microsoft.VisualStudio.ExtensionManager.SVsExtensionManager));
    
        string result = "";
        foreach(Microsoft.VisualStudio.ExtensionManager.IInstalledExtension i in em.GetInstalledExtensions())
        {
            Microsoft.VisualStudio.ExtensionManager.IExtensionHeader h = i.Header;
            if (!h.SystemComponent)
                result += h.Name + " (by " + h.Author + ") v" + h.Version + " " + h.MoreInfoUrl + System.Environment.NewLine;
        }
    

    Copied from https://vlasovstudio.com/visual-commander/commands.html #20.