visual-studio 为 Visual Studio 创建插件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1720975/
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:12:46  来源:igfitidea点击:

Creating a plugin for Visual Studio

c#.netvisual-studiopluginsstylecop

提问by AJM

I'm a fan of style cop but hate the way it dosn't have a more producticve way of resolving errors.

我是风格警察的粉丝,但讨厌它没有更有效的解决错误的方式。

So I'm thinking, to give me a wee project to keep me happy in my spare time, of creating a Visual studio plugin to automate some error fixing.

所以我在想,给我一个让我在业余时间开心的小项目,创建一个 Visual Studio 插件来自动修复一些错误。

Has anyone authored a plug in before and got any useful links, hints, experience to share?

有没有人以前编写过插件并获得任何有用的链接、提示和经验分享?

采纳答案by Elisha

You can write an addin to Visual-Studio on it's addins model directly: http://www.c-sharpcorner.com/UploadFile/mgold/AddIns11292005015631AM/AddIns.aspx

您可以直接在其插件模型上为 Visual-Studio 编写插件:http://www.c-sharpcorner.com/UploadFile/mgold/AddIns11292005015631AM/AddIns.aspx

It requires some hard work since the extension model is not very intuitive.

由于扩展模型不是很直观,因此需要一些艰苦的工作。



You can also do it using DXCore: http://blogs.microsoft.co.il/blogs/dhelper/archive/2009/06/17/how-to-write-a-simple-dxcore-plug-in.aspx

您也可以使用 DXCore:http: //blogs.microsoft.co.il/blogs/dhelper/archive/2009/06/17/how-to-write-a-simple-dxcore-plug-in.aspx

It's a little bit more simple, and the plugins engine is free.

它更简单一点,插件引擎是免费的。



Last option is to write plugins using Resharper, I never did it but it has reach plugins among Style-cop plugin.

最后一个选择是使用 Resharper 编写插件,我从来没有这样做过,但它已经达到了 Style-cop 插件中的插件。

I had experience with both of the first options. First one, VS extensions model, is very hard to work with. It's an old API coming from previous versions of VS, based on classic COM and miss a lot of documentation. Second option, DXCore plugins, is much more intuitive, has reacher API but it also lack some documentation. Another issue is that it requires installation of ~30MB. Good luck :)

我对前两种选择都有经验。第一个,VS 扩展模型,很难使用。它是来自 VS 以前版本的旧 API,基于经典 COM 并且缺少大量文档。第二个选项,DXCore 插件,更直观,有到达 API,但也缺乏一些文档。另一个问题是它需要安装 ~30MB。祝你好运 :)

回答by Phill Duffy

The new Visual Studio 2010 Beta 2 and the SDK have projects designed for this kind of thing. The extensibility options with the new WPF interface will be a great way to get this done:

新的 Visual Studio 2010 Beta 2 和 SDK 有专为这种事情设计的项目。新 WPF 界面的可扩展性选项将是完成此任务的好方法:

http://msdn.microsoft.com/en-us/vstudio/dd441784.aspx#Extensibility

http://msdn.microsoft.com/en-us/vstudio/dd441784.aspx#Extensibility

There is going to be a lot of cool things coming out with 2010

2010年将会有很多很酷的东西出来

The videos are also really good on : http://msdn.microsoft.com/en-gb/vstudio/bb507746.aspxbut these are for older Visual Studio versions

这些视频也非常好:http: //msdn.microsoft.com/en-gb/vstudio/bb507746.aspx但这些适用于较旧的 Visual Studio 版本