Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding Items to Visual Studio Context Menu

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

like image 437
Nathan Roe Avatar asked Nov 06 '22 20:11

Nathan Roe


1 Answers

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.

like image 193
stun Avatar answered Nov 15 '22 11:11

stun