While adding support for SQL Server database projects of VS Team Edition for Database Professionals in my MZ-Tools add-in, I found a nasty bug in the implementation of the ProjectItem.Collection property when the item is a folder:
I used Reflector for .NET to examine the internals of the package and I discovered the code that is wrong, so I opened a new one with a more detailed explanation:
Fortunately once you know the internals of the class that is wrong you can use Reflection to make the correct calls and get the expected result, so the next build of MZ-Tools will support database projects, but I hate when I spend time reporting a bug that will not be fixed or even acknowledged. BTW, they introduced a new bug in VS 2008 that did not exist in VS 2005:
While Visual Studio .NET 2002/2003 use their own font setting for dialogs and toolwindows, Visual Studio 2005 and higher honor the system font, which in Windows Vista is no longer the Tahoma 8.25pt of Windows XP or Windows 2000. See how to do it in your own add-in with my latest article:
Another question that appear frequently in the forums is how to perform some action before or after a build, how to build programmatically or how to retrieve build configurations. My latest article is about that:
This is another article long overdue on my list of pending articles, which appears quite frequently on the forums. It explains how to open a window from a file (ProjectItem) in the desired view (code, designer, text):
Ever wanted to retrieve an EnvDTE.Project from a given project unique name? Today I have discovered that you don’t have to iterate the projects of a solution to find it:
This is another of those questions that appear from time to time in the forums: how to make a command invisible or disabled, how to make it appear only when some condition is true, etc. The answers are in the QueryStatus / AddNamedCommand methods. Since my MZ-Tools add-in does not use a permanent user interface, I was not very interested in this topic or in the optional parameters of the AddNamedCommand method. Finally I decided to investigate about it and I found that, as usual, commands are tricky (as happens with commandbars and buttons) and that there are a couple of bugs (that I reported here) in the extensibility model regarding this that ruin the experience. Each time I am more and more against the permanent user interface in add-ins, which is a half-designed feature, half-implemented and half-tested. Here you have the details:
Ever wanted to know from an add-in whether a context Guid of the EnvDTE80.ContextGuids class, for example vsContextGuidDebugging, vsContextGuidDesignMode, vsContextGuidSolutionExists, vsContextGuidSolutionHasMultipleProjects, vsContextGuidSolutionHasSingleProject, vsContextGuidNoSolution, etc. is active? This new article of mine shows how:
I have updated my most popular (by far) article to include information and sample code about how to create permanent commandbars (via Commands.AddCommandBar) instead of temporary commandbars (via CommandBars.Add):
I have done this for completeness sake, because as I stated in the previous version of the article, I am not big fan of permanent UI in Visual Studio add-ins and I recommend temporary UI instead, which my MZ-Tools add-in uses. My recommendation against permanent commandbars is now bigger than ever: it took me several hours to get the sample code to work, because if temporary commandbars are difficult to program (as usual), permanent commandbars are even worse, much worse (I didn’t even try to test how to remove them when the add-in is uninstalled, that’s left as exercise for you if interested). You get duplicated commandbars each time you debug the add-in in VS 2005 (as someone else reported in a comment here) thanks to the half baked new /resetaddin command-line switch of VS 2005 that add-in projects use when debugging, which resets the commands and buttons but not the commandbars. Fortunately I managed to solve this, the article shows how.
Another question appears from time to time in the forums is how to create a command whose buttons can appear in a checked / unchecked state. Although they are very easy to create, the answer is far from obvious if you don’t know where to look: