Monday, June 14, 2010

The Managed Menu Extension (MME) makes adding right click menus to VS2010 simple and easy (via MEF)

Visual Studio Gallery - Managed Menu Extension (MME)

“Back in 2007 I created the project to make it easier to create custom menu items in the Solution Explorer of Visual Studio 2008. Back then I used the brand new System.AddIn namespace also known as MAF to accomplish this goal.

Now I have upgraded this project to Visual Studio 2010. It is re-developed from the ground up since I now use MEF instead of MAF. MEF has allowed me to make it even easier to create menu items for the solution explorer.

MAF has some advantages over MEF like better Isolation through use of different AppDomains, and an advanced versioning model. But MAF is more complex and I believe not needed for most scenarios involving right click menus. That's is why I went with MEF instead.


  1. Hides Complexity. Installs a Visual Studio Add-In which works behind the scenes and uses MEF to load extensions.
  2. Ease of use. You just implement one interface, IMenuManager which contains 2 methods and place the resulting assembly in a directory.
  3. More powerful. The full DTE object is passed to the implemented IMenuManager if you need it. But you can also use the simpler model you (may) know from Managed Menu Extensions.
  4. One installer. Though I also provide a separate Project Template on the Visual Studio Gallery.
  5. Simple. My ambitions was to provide MenuItems for all kinds of things. Windows Explorer, SharpDevelop and others. But in this edition I focus on the prime target Visual Studio 2010.

Installing your own Menu Extension

When you have created an assembly containing one or more classes implementing IMenuManager, you have to place it in 1 of 3 locations:

  1. You can place it in the same folder as a Visual Studio Solution file (.sln). In this case the Menus will only appear when you open that solution. 
  2. You can place it one folder level above one or more solution files. Then the menus will appear in all the solutions of the subfolders. 
  3. You can place it in the MME subfolder of the CommonAppDataFolder (typically C:\ProgramData\MME). Then the menus appear in all solutions on the machine.

…” [GD: Description Leach Level: 99%]

Visual Studio Gallery - MME MenuManager Template

“This template requires that you have installed MME. MME can either be installed from Visual Studio Gallery via the Extension Manager or from the downloads page of

After installation of this template it is very easy to add a new project to implement Managed Menu Extensions.

Just Choose "Add New Project" and then Visual C# -> Extensibility -> Managed Menu Extension

A Managed Menu Extension is a right click menu for the Visual Studio explorer. You will not believe how easy it is to use. Just implement the 2 methods of the IMenuManager interface, and place the resulting dll in one of 3 locations. …”

CodePlex - Managed Menu Extensions (MME)

“New Edition of Managed Menu Extensions for Visual Studio 2010

The Main goal of "MME" is to provide easy access to adding Right Click menus in the Visual Studio Solution Explorer.

This is accomplished using MEF. All you have to do is implement a simple interface with 2 methods.


A couple things I dig about this. The fact that you can add Solution specific menus I thought was very cool. This way the “menus” can be checked in along with the source making it very easy to keep your entire team in sync.

The second, that the source is available. Many/most of us stand on the shoulders of others and when you make your source code available you are giving back, paying it forward, being the shoulders for others to stand on…

No comments: