Feature Builder - Custom Visual Studio Menu Item

Posted by in Visual Studio category on for Beginner level | Points: 150 | Views : 27599 red flag
Rating: 5 out of 5  
 1 vote(s)

Visual Studio 2010 supports the extensibility of the IDE. We can develop our own extensions for VSTS 2010 and also a set of very useful extensions are available online. In this article, we will discuss about one of the extensions or Power Tools available as part of Visual Studio Gallery- Feature Builder.


Visual Studio 2010 supports the extensibility of the IDE. We can develop our own extensions for VSTS 2010 and also a set of very useful extensions are available online. In this article, we will discuss about one of the extensions or Power Tools available as part of Visual Studio Gallery- Feature Builder.

Feature Builder can be used for various purposes.

  • Customize the Visual Studio IDE Menus
  • Add Custom Project Templates or Item Templates to Visual Studio
  • Dynamic Project or Item Template using T4 template
  • Create Various Custom Wizards
  • Customize the Menu behavior using Map
  • Enforce different rules in software development lifecycle
  • Etc.

In this article we will look into the first usage. How to create a custom Menu Item in Visual Studio IDE using Feature Builder?


Install the feature Builder power tool from  http://visualstudiogallery.msdn.microsoft.com/en-us/396c5990-6356-41c0-aa20-af4c3e58c7ae

You can install and uninstall the same from Extension Manager under Tools menu

Project Templates

When you install the Feature Builder, it adds a set of project templates for various purposes. The project templates are based on various scenarios.

Guidance Workflow Explorer

Once you create a feature extension project, it will display the Guidance Workflow Explorer and Guidance Browser. Guidance Workflow Explorer describes the usage of different scenarios and how we can extend the IDE in a tree-view. Once you select one node in Guidance Workflow Explorer, the description about the topic and associated sample code will be displayed on the Guidance Browser window.

Together Guidance Workflow Explorer and Guidance Browser display an online tutorial of Feature Builder Power Tool and different project templates associated with it.

Creating Menu Item

For creating a visual studio custom menu item, create a new project of type Feature Extension –Starter Pack +Tools Scenario.

The solution will have three projects; one main project, one library project and one Model library project. For generating the Custom Menu Item, we are going to use the following two projects

  1. CustomMenuItem – Main project
  2. CustomMenuItemLib – consists of the Commands, conditions, T4 Helper classes and Value Providers. This will act as the Utility project for our main project.

Custom Command

Right click on Commands Folder under CustomMenuItemLib project and add a Command Class

This will add the Command with default Implementation. Add the execution or our custom code under Execute Method.


public class HelloFromFeatureBuilder : FeatureCommand 
        // Declared public properties will be exposed in the Command Bindings property
        /// <summary>
        /// Gets the Feature Extension instance for this invocation
        /// of the Condition
        /// </summary>
        [Import(AllowDefault = true)]
        public IFeatureExtension Feature { get; private set; }
        /// <summary>
        /// Called when any launch point bound to a command binding which refers to this command
        /// is invoked
        /// </summary>
        /// <param >            System.Windows.Forms.MessageBox.Show("Hello From Feature Builder");

Build the library project.


Open the Feature.commands file under the Main project and remove the default items. You can see the new toolbox with Feature Commands. Drag one VS Launch Point item to the Feature.Commands designer surface.

Now, we need to select the Location where our Custom Menu Item should appear. Double click on the Location, this will open the Visual Studio Command Properties window.

Now, select the location where our custom menu Item should appear. In this sample, I selected the location as Menu|Edit and also specified the display text as HelpFromFX.

Now, we need to bind the new Menu Item with corresponding command. When you click on the new Menu item, we need to perform some custom operation. The custom operation is defined as Command. Drag a Command Binding Item from toolbox to the designer.

Command Binding

Select our Custom Command name as Command Type. Remember, if we are not building the library project before opening the Command Type, the new command name won’t appear here.




Using the Connector from Toolbox, bind or connect the VS Launch Point and Command Binding item. This indicate, when you click on the VS launch point, it should execute the specified command.

Now, our Feature Extension project is ready.  Right click on the designer and select Generate Commands Binding and Launch Point Code option from Context Menu.

This will generate the code under MainProject->GeneratedCode folder. Build the Feature Extension Solution and press Ctrl+F5. This will launch the “Experimental Instance” of Visual Studio.

Experimental Instance

In the experimental Instance of visual studio, go to File-> New Project -> Select the new project template with our solution name ie; CustomMenuItem

This will create a sample class library project. You can see our new MenuItem under the Edit Menu.

Select the MenuItem “HelloFromFX”, which shows our custom message.

We can write any custom code inside the Execute method of the Command class.


Feature Builder is a powerful extension tool available as part of the Visual studio gallery. We will discuss about the other usage of feature builder in next article.

Page copy protected against web site content infringement by Copyscape

About the Author

Full Name: Ambily KK
Member Level: Silver
Member Status: Member,Microsoft_MVP,MVP
Member Since: 5/18/2010 1:05:25 AM
Country: India
Thanks Ambily K K http://ambilykk.com/
I have over 9 years of experience working on Microsoft Technologies. I am carrying the passion on Microsoft technologies specifically on web technologies such as ASP .Net and Ajax. My interests also include Office Open XML, Azure, Visual Studio 2010. Technology adoption and learning is my key strength and technology sharing is my passion.

Login to vote for this post.

Comments or Responses

Login to post response

Comment using Facebook(Author doesn't get notification)