visual-studio Visual Studio 插件开发,第一步

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1872715/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-22 11:17:51  来源:igfitidea点击:

Visual Studio plug-ins development, first steps

visual-studiopluginsvsx

提问by thedp

I would like to make a plug-in for visual studio... But I have no idea where to start. While it was quite easy to find guides for Eclipse plug-in development, I'm having troubles to find a good guide for VS plug-in development.

我想为visual studio做一个插件……但我不知道从哪里开始。虽然很容易找到 Eclipse 插件开发指南,但我很难找到 VS 插件开发的好指南。

I guess what I'm trying to ask here, is where do I start?

我想我在这里想问的是,我从哪里开始?

采纳答案by Peter Macej

I suggest to start here: http://www.mztools.com/resources_vsnet_addins.aspxThis is great set of resource for VS add-in developers. Creating VS add-in is quite easy. Some keywords if you want to search for more: VS add-in (plugin is not very used), VS extensibility, VS automation.

我建议从这里开始:http: //www.mztools.com/resources_vsnet_addins.aspx这是 VS 插件开发人员的绝佳资源集。创建 VS 插件非常简单。一些关键字如果你想搜索更多:VS插件(插件不是很常用),VS可扩展性,VS自动化。

回答by Aaron Marten

The best place to start for pointers to tools, documentation, etc... is the Visual Studio Extensibility Dev Center on MSDN.

指向工具、文档等的指针的最佳起点是MSDN 上Visual Studio 可扩展性开发中心

What you want to do next really depends on what you're trying to build. If you want just a simple plugin (maybe a menu command that runs some code against the Visual Studio Automation model: EnvDTE), you could do an Addin. (There are templates for Addins in-the-box under Other Project Types -> Extensibility in the New Project dialog.)

您接下来想要做什么实际上取决于您要构建的内容。如果您只想要一个简单的插件(可能是一个针对Visual Studio 自动化模型运行一些代码的菜单命令:EnvDTE),您可以做一个插件。(在“新建项目”对话框中的“其他项目类型”->“可扩展性”下有内置插件模板。)

If you want your extension to be a "first class citizen" (i.e. full API access like the other extensions in the box), you should download the Visual Studio SDK and create a VSPackage.

如果您希望您的扩展成为“一等公民”(即像框中的其他扩展一样拥有完整的 API 访问权限),您应该下载 Visual Studio SDK 并创建一个 VSPackage。

While Visual Studio remains (even in 2010) a largely COM-based application, there are managed libraries (e.g. Microsoft.VisualStudio.Shell.*) and interop assemblies for accomplishing many kinds of extensions.

虽然 Visual Studio 仍然(即使在 2010 年)仍然是一个主要基于 COM 的应用程序,但有托管库(例如 Microsoft.VisualStudio.Shell.*)和用于完成多种扩展的互操作程序集。

The Editor in Visual Studio 2010 was rebuilt in managed code and uses MEF as its extensibility model. You can also find templates for MEF-based editor extensions in the Visual Studio SDK for 2010.

Visual Studio 2010 中的编辑器在托管代码中重建,并使用 MEF 作为其扩展模型。您还可以在 Visual Studio SDK for 2010 中找到基于 MEF 的编辑器扩展的模板。

回答by kiwipom

there's a codeplex project herethat shows how to create a VS plug-in, but I found it to be quite involved, and more detailed around the specific implementation, than a generic 'getting started with plug-ins' guide...

有一个CodePlex项目在这里展示了如何创建一个VS插件,但我发现它是相当复杂,以及更详细的各地具体执行,比一般的“入门插件”指南...

anyway - it might be a starting point for you :)

无论如何 - 这可能是你的起点:)

回答by Anton Gogolev

Never developed a single plug-in for Visual Studio, but nevertheless here are my thoughts.

从来没有为 Visual Studio 开发过一个插件,但这里是我的想法。

Plugins for VS were historically a nightmare to build: all these COM interfaces sticking out from various odd ends, WEIRD_CONSTANTS_IN_GLOBAL_SCOPE, etc. If I were to develop a VS plugin, I'd target Visual Studio 2010, which is, as they say, is really nicer in this respect.

VS 插件历来是构建的噩梦:所有这些 COM 接口都从各种奇怪的末端伸出,WEIRD_CONSTANTS_IN_GLOBAL_SCOPE 等。如果我要开发 VS 插件,我的目标是 Visual Studio 2010,正如他们所说,在这方面真的更好。

Moreover, if your plugin has anything to do with C#/VB.NET code, consider writing a plugin for ReSharper.

此外,如果您的插件与 C#/VB.NET 代码有关,请考虑为 ReSharper 编写插件。