views:

202

answers:

1

I'd like to add an item into the Visual Studio 2008 context menu exactly how ASP.NET MVC projects have "Add View" or "Add Controller" items in the context menu. How would I accomplish this? Do I have to write an add-in?

Thanks, Nathan

+2  A: 

Hi Nathan,

you and I are probably trying to do the same kind of thing.
So I will share whatever I have found while doing my own research.

Oleg Sych was kind enough to point me to the ASP.NET MVC dll Microsoft.VisualStudio.Web.Extensions.dll file that contains the MvcTextTemplateHost class.
Take a look at this DLL using the .NET Reflector tool.

C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\Microsoft.VisualStudio.Web.Extensions.dll



As you will see, the DLL contains WinForm classes such as MvcAddControllerDialog, MvcAddViewDialog, and other classes.
So I am pretty sure you can dig around in there to figure out how they did it.

Another place to look is definitely the Visual Studio Extensibility Developer Center.
In the [Learning Center Resources] section, click on [Custom Wizards] link (msdn.microsoft.com/en-us/vsx/dd631327.aspx --- sorry I can include ONE Hyperlink per post at the moment).

Wizards can be implemented in Visual Studio to let users select from a tree view of available values when they open the Add New Project dialog box or the Add New Item dialog box, or when they right-click an item in Solution Explorer.

So start from those two places. I will post some updates myself as well if I found out more.

stun
I think I know how to display a custom wizard, but I need to know how to add a button to a context menu to open up that wizard.
Nathan Roe