Visual Studio 2008插件/加载项开发 - 入门

时间:2022-10-17 05:30:52

hey guys, in relation to this * question, how would I go about creating my own Visual Studio 2008 plug-in.

嘿伙计们,关于这个*问题,我将如何创建自己的Visual Studio 2008插件。

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.

我在MSDN上检查过Visual Studio开发人员中心,但信息量太大了。有很多项目类型,我甚至不知道从哪里开始。

Where should I start looking if I want to write something which meets the following requirements:

我应该从哪里开始查看是否要写出符合以下要求的内容:

  1. A plug-in that runs like a "service" in Visual Studio, and is able to poll Visual Studio for information, and handle Visual Studio events.
  2. 一个插件,在Visual Studio中像“服务”一样运行,能够在Visual Studio中查询信息,并处理Visual Studio事件。

  3. The info I'd like to access from VS are things like, what projects are currently open, who has them open, and other solution/project file based info.
  4. 我想从VS访问的信息包括:当前打开哪些项目,谁打开它们,以及其他基于解决方案/项目文件的信息。

  5. The events I'd like to be able to handle are things like, the opening/closing/editing/creating/deleting of Solutions / Projects / individual files.
  6. 我希望能够处理的事件包括解决方案/项目/个人文件的打开/关闭/编辑/创建/删除。

  7. I'd also like to be able to handle any interaction with VS on a per solution basis. So, I'd like to handle any interaction with files, even code editing, but also, just other interaction, like with the menus, or just the IDE itself.
  8. 我还希望能够在每个解决方案的基础上处理与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..?

除了这些,我还希望能够在某处存储数据。这通常在哪里?我可以将元数据添加到解决方案文件中吗?或者,将此信息保存到数据库的小型本地实例是否有意义,该实例以某种方式附加到解决方案..?

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?

我只需要朝着正确的方向努力,这有可能吗?我应该关注Visual Studio开发人员中心的哪个部分?我应该查看哪些API?

cheers!

2 个解决方案

#1


An add-in can do most of that. There's a template in VS2008 for creating a base add-in.

加载项可以完成大部分工作。 VS2008中有一个用于创建基本加载项的模板。

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.

我有一个加载项,您可以将该钩子下载到解决方案/项目加载事件等 - 它是免费的,并附带源代码(http://www.huagati.com/projectloader/download/huagatiprojectloader.zip)。此特定加载项检测何时加载项目/解决方案并预加载引用的程序集以解决可能导致VS2008崩溃的CLR错误。无论如何,它的源代码显示了如何检测您正在寻找的一些事件。

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 ).

除此之外,附加开发的权威资源以及所涉及的所有小怪癖和技巧都是Carlos Quintero的博客(http://msmvps.com/blogs/carlosq/)和他网站上的“howto”文章系列(http ://www.mztools.com/resources_vsnet_addins.aspx)。

Craig Skibo's blog ( http://blogs.msdn.com/craigskibo/ ) also has some useful tips.

Craig Skibo的博客(http://blogs.msdn.com/craigskibo/)也有一些有用的提示。

#2


You want:

  1. Visual Studio Extensibility Developer Center
  2. Visual Studio可扩展性开发人员中心

  3. VSX Forum
  4. Visual Studio 2008 SDK
  5. Visual Studio 2008 SDK

  6. Professional Visual Studio Extensibility by Keyvan Nayyeri
  7. Keyvan Nayyeri的专业Visual Studio可扩展性

Buy the book, if nothing else.

买这本书,如果没有别的。

#1


An add-in can do most of that. There's a template in VS2008 for creating a base add-in.

加载项可以完成大部分工作。 VS2008中有一个用于创建基本加载项的模板。

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.

我有一个加载项,您可以将该钩子下载到解决方案/项目加载事件等 - 它是免费的,并附带源代码(http://www.huagati.com/projectloader/download/huagatiprojectloader.zip)。此特定加载项检测何时加载项目/解决方案并预加载引用的程序集以解决可能导致VS2008崩溃的CLR错误。无论如何,它的源代码显示了如何检测您正在寻找的一些事件。

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 ).

除此之外,附加开发的权威资源以及所涉及的所有小怪癖和技巧都是Carlos Quintero的博客(http://msmvps.com/blogs/carlosq/)和他网站上的“howto”文章系列(http ://www.mztools.com/resources_vsnet_addins.aspx)。

Craig Skibo's blog ( http://blogs.msdn.com/craigskibo/ ) also has some useful tips.

Craig Skibo的博客(http://blogs.msdn.com/craigskibo/)也有一些有用的提示。

#2


You want:

  1. Visual Studio Extensibility Developer Center
  2. Visual Studio可扩展性开发人员中心

  3. VSX Forum
  4. Visual Studio 2008 SDK
  5. Visual Studio 2008 SDK

  6. Professional Visual Studio Extensibility by Keyvan Nayyeri
  7. Keyvan Nayyeri的专业Visual Studio可扩展性

Buy the book, if nothing else.

买这本书,如果没有别的。