Archive for March, 2008

The VSCT PowerToy

Friday, March 28th, 2008

One thing that amazes me about the technical blogosphere is how fast information travels. Yesterday the VSX team blog posted an entry about the VSCT power toy, something that—from the screenshot shown in that entry—looks indispensable when working with packages. The power toy, which installs in Program Files by default under the VSCTPowerToy directory, is a stand-alone application whose UI breaks down the components of command tables from any VS package, or Visual Studio itself, into a logical tree-view of information, a part of which is shown below:

image

The picture above illustrates the basic structure when the power toy analyzes Visual Studio itself. Because of how many commands there are in Visual Studio, it would be overwhelming to show them all in the image, so it may be more helpful to look at the command table for a specific package or VSCT file. If you’ve been reading this blog you can probably infer that my “favorite” package is the LINQ to SQL package, so let’s have at some more features of the tool with it. (For reference, from your Visual Studio 2008 install directory, it is in Common7\IDE\Microsoft.VisualStudio.ORDesigner.DslPackage.dll.) Simply opening the DLL in the power toy gives us the following:

 image

As you can see, we can drill down into the menus exposed by the VSCT file embedded in the LINQ to SQL package assembly. Although small compared to the rest of Visual Studio, packages like these can really help you become familiar with the taxonomy of groups, menus, buttons, etc. that are involved in a command table. Another advantage is that it shows you the snippet of the file you have highlighted in the treeview. For example, since we highlighted the Association button in the picture above, a contextual snippet window below will show the following:

image

And there it is, as specified in the original VSCT file. I am not sure about whether snippets from other files in their respective formats, or whether they show in a VSCT format like this one. Regardless, this functionality can be a great aid to package developers looking for an easy way to find their desired hooks within Visual Studio. Give this tool and try and be sure to check out the document (linked on this page) for more features!

Dynamic Menu Commands in Visual Studio Packages - Part 2

Saturday, March 22nd, 2008

In this post I’ll be building on the principles of my last post with dynamic menu development in Visual Studio, so if you haven’t read that post please go back and check it out!

If you remember from last time, we were able to create a dynamic menu command without any lines of procedural code (other than those generated by the wizard). The result was a menu command that showed itself only when no solution was loaded in Visual Studio. Immediately a solution was loaded, the menu command disappeared. The limitations of this approach are that you’re reliant on built-in UI contexts, such as UICONTEXT_NoSolution. However, what I needed for my DBML Fixup project was a way to add menu commands when right clicking on .dbml files (LINQ to SQL Classes) in the Solution Explorer. The built-in UI contexts that we reviewed in the previous post are not enough to give us this functionality. In this tutorial, I take you through step-by-step on how to add this feature to your VS packages. We have to do a bit of digging though, so let’s get started!

(more…)

LINQ Design Guidelines

Tuesday, March 18th, 2008

As a follow-up to the first Framework Design Guidelines, there’s been a new post on Mircea Trofin’s blog on the LINQ Framework Design Guidelines. They are a great read, and you will probably find something that you didn’t consider before in designing applications with LINQ.

Please leave your feedback!

Dynamic Menu Commands in Visual Studio Packages - Part 1

Friday, March 14th, 2008

As I get further into my DBML Fixup project, I’m learning more and more about Visual Studio Extensibility (VSX). Along the way, I have found multiple blogs which have helped me to learn a lot more than I would than just stepping through the documentation. (Those blogs are now listed on the sidebar.) The one I find especially helpful for beginners like me is DiveDeeper, whose LearnVSXNow tutorials are great stepping stones in learning the basics of VSX Packages. He currently has 14 tutorials, the first of which is located here. Although his blog is very helpful for learning about how to work with menu commands, he hasn’t (yet?) delved into making them dynamic. I needed to do this for my project, so I had to "dive deeper," as it were.

In this series of posts I’m going to focus on three ways to make menu commands dynamic—that is, how to make menu commands invisible or disabled in certain contexts, but visible and enabled in others. Two of these ways I found through some experimentation. Consequently, I’m not sure whether these represent VSX best practices, so if anyone has any more input, it would be greatly appreciated. With that said, let’s get started.

(more…)