I have been visiting forums about Visual Studio extensibility since year 2002 or so, and it is almost a law that if you are a newbie starting in this world of add-ins, you will have to ask the same questions that others before you because you don’t know the basics or you find an unexpected behavior. So, I have written many HOWTO, INFO, BUG and PRB articles on my web site but here are the most popular.
If you only have time to read one of the articles, this is the most popular one:
HOWTO: Adding buttons, commandbars and toolbars to Visual Studio .NET from an add-in
http://www.mztools.com/articles/2005/MZ003.htm
Chances are that if you are writting an add-in, you will need a command and a button and likely a set of them so you will want a toolbar. Alas, commands, buttons and commandbars are the most difficult part of writing add-ins, so ensure that you understand how they work. The question is so complex that there are several related articles at the end of that one, so I won’t repeat them here.
If you are working with C#, then ensure that you read this one:
PRB: Visual Studio .NET events being disconnected from add-in.
http://www.mztools.com/articles/2005/MZ012.htm
Because again, chances are that you will want to capture events, and if you don’t do it correctly, you will capture them for a while but at some point you won’t capture them. VB.NET developers are more fortunate and thanks to the WithEvents keyword they don’t incurre in the pitfall described in the article.
Before I said that creating commands, buttons, and toolbars is the most difficult task and now I realize that I lied. Or at least, partially. The most difficult task is to put a custom picture in a button, and once you think that you have got it, you are only half way, because, of course, you want it transparent and sometimes you get it green, or magenta, or gray. Somehow, Microsoft have managed to do this incredibly painful since VB5 back in 1997 and it is yet painful in 2005 with VS 2005 and I wish it was so easy as to pass a .NET managed icon (icon, which support transparency, not bitmap) but I have no hope for VS “Orcas” in 2007 ten years later so get familiar with the lime green and magenta colors, a resource editor, a satellite dll and here we go:
HOWTO: Creating custom pictures for Visual Studio .NET add-ins commands, buttons and toolwindows
http://www.mztools.com/articles/2005/MZ007.htm
If you want to work with Windows Forms controls from an add-in, you need to meet a new (foreign) guy in town, the PropertyDescriptor type:
HOWTO: Manipulating controls of Windows forms from Visual Studio .NET add-ins.
http://www.mztools.com/articles/2005/MZ001.htm
If you are just creating macros (not even add-ins) to navigate your code (projects or code elements), again a tricky proposition, here are the ones that you need:
HOWTO: Navigate the files of a solution from a Visual Studio .NET macro or add-in.
http://www.mztools.com/articles/2006/MZ004.htm
HOWTO: Navigate the code elements of a file from a Visual Studio .NET macro or add-in
http://www.mztools.com/articles/2006/MZ008.htm
Sometimes you want to work with the references of a project but, alas, they don’t appear in the EnvDTE namespace. Did Microsoft omit them? No, but they are a little hidden:
HOWTO: Getting information specific to VB.NET and C# projects from an add-in or macro.
http://www.mztools.com/articles/2005/MZ011.htm
And finally this one also appears from time to time: how do I create a tabbed window (like a document window) from an add-in? Well, a toolwindow will do the trick:
HOWTO: Understanding toolwindow states in Visual Studio
http://www.mztools.com/Articles/2006/MZ025.htm
And of course, you have lots more here:
http://www.mztools.com/resources_vsnet_addins.htm