Visual Studio 2008插件/加载项开发-入门 [英] Visual Studio 2008 Plug-in / Add-in development - Getting Started
问题描述
伙计们,与>此项目有关stackoverflow问题,我将如何创建自己的Visual Studio 2008插件.
hey guys, in relation to this stackoverflow question, how would I go about creating my own Visual Studio 2008 plug-in.
我已经检查了MSDN上的Visual Studio开发人员中心,但是信息量却很多.项目类型很多,我什至不知道从哪里开始.
I've checked the Visual Studio Developer Centre on MSDN, but the amount of info is overwhelming. There are loads of project types, and I don't even know where to start.
如果我想写满足以下要求的内容,应该从哪里开始寻找:
- 一个插件,在Visual Studio中像服务"一样运行,并且能够向Visual Studio查询信息并处理Visual Studio事件.
- 我想从VS访问的信息包括诸如以下内容:当前正在打开的项目,谁打开了这些项目以及其他基于解决方案/项目文件的信息.
- 我想处理的事件是诸如解决方案/项目/单个文件的打开/关闭/编辑/创建/删除之类的事情.
- 我还希望能够在每个解决方案的基础上处理与VS的任何交互.因此,我想处理与文件的任何交互,甚至是代码编辑,但也要处理其他交互,例如与菜单的交互,或者仅是IDE本身.
除了这些,我还希望能够将数据存储在某个地方.通常在哪里做?我可以将元数据添加到解决方案文件中吗?或者,将此信息保存到数据库的一个小型本地实例中是否有意义,该实例以某种方式附加到该解决方案上..
As well as these, I'd also like to be able to store data somewhere. Where is this usually done? Can I add Metadata to the Solution file? Or, does it make sense to save this info to a small local instance of a database, that is somehow attached to the solution..?
我只需要向正确的方向推进,这有可能吗?我应该关注Visual Studio开发人员中心的哪一部分?我应该检出哪些API?
I just need a push in the right direction, is any of this possible? What part of the Visual Studio Developer Centre should I focus on? What APIs should I check out?
欢呼!
推荐答案
外接程序可以完成大部分工作. VS2008中有一个用于创建基本加载项的模板.
An add-in can do most of that. There's a template in VS2008 for creating a base add-in.
我有一个加载项,您可以下载该加载项,它挂接到解决方案/项目加载事件等中-它是免费的,并且附带源代码( download/huagatiprojectloader.zip"rel =" noreferrer> http://www.huagati.com/projectloader/download/huagatiprojectloader.zip ).这个特定的加载项检测何时加载项目/解决方案,并预加载引用的程序集,以解决可能导致VS2008崩溃的CLR错误.无论如何,它的源代码显示了如何检测您正在寻找的某些事件.
I have an add-in that you can download that hooks into the solution/project load events etc - it is free and comes with source code ( http://www.huagati.com/projectloader/download/huagatiprojectloader.zip ). This particular add-in detects when projects/solutions are loaded and pre-loads referenced assemblies to work around a CLR bug that can cause VS2008 to crash. Anyway, the source code for it shows how to detect some of the events you're looking for.
除此之外,有关外接程序开发以及涉及的所有小怪癖和技巧的权威资源是Carlos Quintero的博客( http://www.mztools.com/resources_vsnet_addins.aspx ).
Other than that, the definitive resource on add-in development and all the little quirks and tricks involved is Carlos Quintero's blog ( http://msmvps.com/blogs/carlosq/ ) and the "howto" article series on his website ( http://www.mztools.com/resources_vsnet_addins.aspx ).
Craig Skibo的博客( http://blogs.msdn.com/craigskibo/)也有一些有用的提示.
Craig Skibo's blog ( http://blogs.msdn.com/craigskibo/ ) also has some useful tips.
这篇关于Visual Studio 2008插件/加载项开发-入门的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!