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

发布于 2024-07-20 15:35:17 字数 842 浏览 6 评论 0原文

关于此 stackoverflow 问题 ,我将如何创建自己的 Visual Studio 2008 插件?

我查看了 MSDN 上的 Visual Studio 开发人员中心,但信息量巨大。 项目类型繁多,我什至不知道从哪里开始。

如果我想编写满足以下要求的内容,我应该从哪里开始寻找

  1. 一个在 Visual Studio 中像“服务”一样运行的插件,并且能够轮询 Visual Studio 获取信息,并且处理 Visual Studio 事件。
  2. 我想从 VS 访问的信息包括当前打开的项目、谁打开的项目以及其他基于解决方案/项目文件的信息。
  3. 我希望能够处理的事件包括打开/关闭/编辑/创建/删除解决方案/项目/单个文件。
  4. 我还希望能够在每个解决方案的基础上处理与 VS 的任何交互。 因此,我想处理与文件的任何交互,甚至是代码编辑,而且还可以处理其他交互,例如与菜单的交互,或者只是 IDE 本身的交互。

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

我只需要朝着正确的方向推动,这一切可能吗? 我应该关注 Visual Studio 开发人员中心的哪一部分? 我应该检查哪些 API?

干杯!

In relation to this stackoverflow question, how would I go about creating my own Visual Studio 2008 plug-in?

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.

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. 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.
  3. The events I'd like to be able to handle are things like, the opening/closing/editing/creating/deleting of Solutions / Projects / individual files.
  4. 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.

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?

cheers!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

抱着落日 2024-07-27 15:35:17

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

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

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

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

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

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.

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's blog ( http://blogs.msdn.com/craigskibo/ ) also has some useful tips.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文