如何以编程方式安装

如何以编程方式安装

本文介绍了如何以编程方式安装 VisualStudio 扩展?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获取已安装的 VisualStudio 扩展的列表?以某种方式通过DTE?只是名字就足够公平了.

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

推荐答案

这是否有帮助:

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;
    }

复制自 https://vlasovstudio.com/visual-commander/commands.html #20.

这篇关于如何以编程方式安装 VisualStudio 扩展?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 06:15