views:

3423

answers:

2

hey guys, 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!

+3  A: 

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.

KristoferA - Huagati.com
@kristoferA: hey kristofer, awesome, thanks for the source code, much appreciated
andy
+2  A: 

You want:

  1. Visual Studio Extensibility Developer Center
  2. VSX Forum
  3. Visual Studio 2008 SDK
  4. Professional Visual Studio Extensibility by Keyvan Nayyeri

Buy the book, if nothing else.

John Saunders
cool, thanks Saunders, I'm not very good with learning from books, just doesn't click with me, call it dyslexia, ADD or...lazyness...surely not. I need to either just try it out or talk to someone about it. If I get stuck though, I'll definitely check it out.
andy
You're going to have a problem in this area, then. It's extremely rich, but not clean. The next step would be the samples in the VS2008 SDK, but good luck learning this area without some structure. BTW, I'm the last person on Earth likely to call this laziness.
John Saunders