问题描述
我已将 ASP.NET MVC 4 集成到现有的 asp.net 网站中.两者都可以正常工作,但我没有看到任何用于在 Visual Studio IDE 中创建控制器/视图的菜单/快捷方式.那些仅适用于 ASP.NET MVC 模板吗?
I have integrated ASP.NET MVC 4 into existing asp.net web site. Both works fine but I don't see any menu/shortcuts to create controller/view within visual studio IDE. Are those only available to ASP.NET MVC template?
推荐答案
是的,但你可以作弊.Visual Studio 显示这些快捷方式的方式是查看项目类型,如果它看到它是一个 ASP.NET MVC 项目,它将使它们可用.但是它怎么知道它是一个 ASP.NET MVC 项目呢?毕竟 ASP.NET MVC 是一个 ASP.NET 项目.
Yes, but you could cheat. The way Visual Studio shows those shortcuts is by looking at the project type and if it sees that it is an ASP.NET MVC project it will make them available. But how does it know it is an ASP.NET MVC project? After all ASP.NET MVC is an ASP.NET project.
打开 .csproj
文件并查找 ASP.NET MVC 4 项目的 节点.你会看到这样的:
Open the .csproj
file and look for the <ProjectTypeGuids>
node of your ASP.NET MVC 4 project. You will see something like this:
<ProjectTypeGuids>{E3E379DF-F4C6-4180-9B81-6769533ABE47};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
现在打开常规 ASP.NET 项目的 .csproj
文件,只需添加 {E3E379DF-F4C6-4180-9B81-6769533ABE47}
GUID 作为第一项列表(如果你不投影甚至不加载).就这样.现在,您将在 WebForms 项目中看到 ASP.NET MVC 特定的上下文菜单.
Now open the .csproj
file of your regular ASP.NET project and simply add the {E3E379DF-F4C6-4180-9B81-6769533ABE47}
GUID as first item in the list (if you don't project does not even load). That's all. Now you will see the ASP.NET MVC specific context menus in your WebForms project.
这篇关于添加控制器/视图缺失的上下文菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!