将ASP.NET MVC添加到Webforms应用程序-如何在VS2010中获取MVC菜单选项?

问题描述:

我有一个ASP.NET WebForms应用程序,正在向其中添加一些ASP.NET MVC.

I have an ASP.NET WebForms application that I'm adding some ASP.NET MVC to.

我可以使用它,但是如何使Visual Studio识别它现在是MVC项目,并为我提供上下文菜单选项以在控制器操作方法中添加视图等?

I have it working, but how can I get Visual Studio to recognise that it's now an MVC project and give me the context menu options to add a view, etc. inside a controller action method?

使用您喜欢的文本编辑器(不是Visual Studio)打开.csproj文件,并添加以下GUID:

Open the .csproj file with your favorite text editor (not Visual Studio) and add the following GUID:

<ProjectTypeGuids>{F85E285D-A4E0-4152-9332-AB1D724D3325};{fae04ec0-301f-11d3-bf4b-00c04f79efbc};{349c5851-65df-11da-9384-00065b846f21}</ProjectTypeGuids>

注意{F85E285D-A4E0-4152-9332-AB1D724D3325} GUID.这表明它是一个ASP.NET MVC项目.

Notice the {F85E285D-A4E0-4152-9332-AB1D724D3325} GUID. This is what indicates that it is an ASP.NET MVC project.

将此GUID添加到ProjectTypeGuids节点后,您将获得上下文菜单.

Once this GUID added to the ProjectTypeGuids node you will get the context menus.