如何以编程方式启用 Visual Studio 扩展 [英] How to programmatically enable visual studio extension

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

问题描述

我创建了一个 Visual Studio 扩展并将其打包在 Visual Studio 设置中.现在,当我安装安装程序时,vsix 被安装并且也在扩展管理器窗口中看到,但它处于禁用状态.我尝试过为扩展添加注册表项等方法......但同样没有用.

I have created a visual studio extension and have packaged it in visual studio setup. Now, when i install the setup, the vsix gets installed and is also seen in the Extension manager window, but its in disabled state. I have tried methods like adding registry entry for the extension and etc... but same was not useful.

推荐答案

您应该将 ProvideAutoLoad 属性添加到您的包类中,并在加载时指定 UI 上下文.对于自动加载 vsix,你应该这样写:

You should add ProvideAutoLoad attribute to your package class and specify UI context when it's going to load. For auto-load vsix you should write sthm like this:

[ProvideAutoLoad(VSConstants.UICONTEXT.NotBuildingAndNotDebugging_string)]
public sealed class MyVSIX : Package

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆