Category Archives: Other

Tools for the toolset of add-in developers

When you think about developing add-ins likely you think that the only tools that you need are Visual Studio IDE and its debugger, right? Well, sometimes you will find that your add-in does not appear in the Add-In Manager at all, or it doesn’t load (apparently) or it causes some COM exception when it is loaded. I see those questions frequently in the extensibility forums and I always recommend to add these tools to your debugging toolset:

  • A registry monitor, to spy what VS does when it tries to discover your add-in (if your add-in uses COM and registry-based registration, not XML-based registration).
  • A file monitor, to spy disk activity when you are using XML-based registration (an .Addin file).

I used two separated tools from sysinternals (recently purchased by Microsoft) but the good news is that they are now merged into a new all-in-one monitoring tool named Process Monitor:

http://www.microsoft.com/technet/sysinternals/FileAndDisk/processmonitor.mspx

The Process Monitor also replaces the Process Explorer tool that I was using to monitor which processes are running and which DLLs are loaded (it can be configured to replace the Task Manager of Windows too!)

There are other tools here:

http://www.microsoft.com/technet/sysinternals/default.mspx

There is another invaluable tool named Lutz Roeder’s .NET Reflector (http://www.aisto.com/roeder/dotnet/)  which allows you to disassemble a .NET assembly and generate not only IL code (like ildasm) but also VB.NET or C# code. There are even plug-ins for that tool that save the disassembled code (which is shown on the screen) to a file or to a whole new VS project. This tool is invaluable when you want to know how VS works internally, for the portions that are managed code (VS is still a COM application), which are most of the new portions of VS 2005. You can use it also to see the internals of the designers of the .NET Framework, etc. The first thing to know is where to look. Many assemblies of VS 2005 are in this folder:

C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies

But others seems to be only in the GAC. Say that you want to know how the Document Outline feature of VS 2005 is implemented internally. It happens that this feature is in this assembly of the GAC (I have been unable to find it elsewhere):

Microsoft.VisualStudio.Windows.Forms.dll

How do you use .NET Reflector to disassemble that assembly (the several “Open” dialogs of the tool don’t show it)? Here is a little trick (it’s a good thing that I am old enough to know MS-DOS):

  • Open a DOS command prompt
  • Type:

SUBST P: C:\Windows\Assembly

and then you can navigate to:

P:\GAC_MSIL\Microsoft.VisualStudio.Windows.Forms\2.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Windows.Forms.dll and the class is Microsoft.VisualStudio.Windows.Forms.DocumentOutline. So you expand it, select a method, right-click “Disassembler” and there it is the code! You can also right-click “Analyzer” to show where a method is called. With this tool you can know how the Property Browser works insternally (quite complicated indeed!) and other portions of VS 2005. Alas, many other portions of VS are unmanaged so there is no X-ray for them (unless you like the native x86 code) 🙂

It’s about time!

Finally I decided to start a blog about Visual Studio extensibility: macros, add-ins, templates, SDK packages, and so on. My name is Carlos Quintero, I am from Madrid (Spain) (so I do not speak English natively as you will notice) and I am Microsoft Most Valuable Professional (MVP) since 2004. If you have come to my blog chances are that you already know me from the several forums and newsgroups about VS extensibility and you know about my web site http://www.mztools.com and my MZ-Tools add-in for the family of Microsoft IDEs  (VB5, VB6, VBA, VS.NET and VS 2005).

If you are starting with VS extensibility, I recommend you to visit the a section of my website with lots of resources (documentation, articles, samples, forums, newsgroups, blogs, videos, webcasts, etc.):

Resources about Visual Studio .NET 2002/2003 and Visual Studio 2005 extensibility
http://www.mztools.com/resources_vsnet_addins.htm

As you can see I update it with new resources available on the web and I write 20-30 small articles about VS extensibility each year and from now on I will announce them here so you have a reason to subscribe through RSS to this blog if you are interested in this subject.

If you have questions about VS extensibility, post them on this forum which I visit quite regularly:

Visual Studio Extensibility
http://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=vsx

And that’s all for now. BTW, I am currently at the TechEd Developers Barcelona 2006 where there are some good sessions about VS extensibility.