将项添加到Visual Studio上下文菜单

[英]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?

我想在Visual Studio 2008上下文菜单中添加一个项目,确切地说ASP.NET MVC项目在上下文菜单中有“添加视图”或“添加控制器”项。我怎么做到这一点?我必须写一个加载项吗?

Thanks, Nathan

1 个解决方案

#1


2  

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.

Oleg Sych非常友好地指向包含MvcTextTemplateHost类的ASP.NET MVC dll Microsoft.VisualStudio.Web.Extensions.dll文件。使用.NET Reflector工具查看此DLL。

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.

正如您将看到的,DLL包含WinForm类,如MvcAddControllerDialog,MvcAddViewDialog和其他类。所以我很确定你可以在那里挖掘一下,弄清楚他们是如何做到的。

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

另一个值得关注的地方是Visual Studio可扩展性开发人员中心。在[学习中心资源]部分,单击[自定义向导]链接(msdn.microsoft.com/en-us/vsx/dd631327.aspx ---抱歉,我现在可以在每个帖子中包含一个超链接)。

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.

可以在Visual Studio中实现向导,以便用户在打开“添加新项目”对话框或“添加新项”对话框时,或者在解决方案资源管理器中右键单击某个项时,从树视图中选择可用值。

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

所以从这两个地方开始。如果我发现更多,我会自己发布一些更新。

智能推荐

注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:http://www.silva-art.net/blog/2009/07/15/53539b71d541013b1f3f768dd7e67dee.html



 
© 2014-2019 ITdaan.com 粤ICP备14056181号  

赞助商广告