Archive for the 'VSX' Category

DBML Fixup Preview

Sunday, August 24th, 2008

Back in February I blogged about DBML Fixup—a tool whose goal was to sync LINQ to SQL models with their respective database schemas from within the Visual Studio environment, as well as to handle running various fixup tasks on models. Now it’s six months later, and I have a much clearer vision of what the tool is meant to be as well as a firmer command on VSX. The following screencast is a preview of the features of DBML Fixup.

 

 

Here are some previous posts which (briefly) describe the domain:

http://blogs.rev-net.com/ddewinter/2008/02/16/the-linq-to-sql-model/

http://blogs.rev-net.com/ddewinter/2008/02/16/linq-to-sql-and-database-schema-sync/

 

Any ideas about directions for the tool? Or maybe something that wasn’t covered in the screencast? I’d love to hear your ideas.

Dynamic Menu Commands in Visual Studio Packages - Part 3

Saturday, April 5th, 2008

This is the final post in a series detailing how to build dynamic menu commands in Visual Studio packages. The previous posts are located here:

  • Part 1 - Discusses UI Contexts and how to utilize the built-in ones for dynamic menu commands.
  • Part 2 - Discusses the use of the BeforyQueryStatus event to provide more flexibility than built-in UI contexts.

What we’ve explored to date is a way to provide dynamic menu commands (e.g. dynamic visibility, enabled state) in our own package, and the techniques that I’ve shown thus far have worked well for this scenario. However, if you want to develop multiple menu commands or even multiple packages that rely on a custom condition (as shown in Part 2), then you’re stuck implementing the same logic in an event handler for the BeforeQueryStatus event for each OleMenuCommand.

Wouldn’t it be great if we could create our own UI Context, similar to the built-in ones like UIContext_NoSolution or UIContext_FullScreenMode? That way we can create multiple menu commands that rely on that context or even multiple packages which rely on it.

And that’s exactly what this post will cover. We’ll use the solution starting from where we left off at the end of Part 2.

(more…)

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…)

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…)