Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
386 views
in Technique[技术] by (71.8m points)

c# - How do I get the “Add Controller” and “Add View” menu options in my ASP.NET MVC 5 project?

I upgraded my solution from MVC 4 to MVC 5 in Visual Studio 2012 using this tutorial. In the last step I removed the ProjectTypeGuid for MVC 4 from my .csproj file.

Now the problem is that I don't see Add Controller, Add View in Visual Studio when I want to create new Controllers/Views.

I read this answer for MVC 4 so I know I need to get the correct ProjectTypeGuid for MVC 5 in order to regain that functionality. I was wondering if anyone knows what that is so that I can add them to my .csproj file?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Install the following items:

  1. Visual Studio 2012 Update 4
  2. Web Tools 2013.1 for Visual Studio 2012 (Web Platform Installer | Direct Download)

Then follow this tutorial to upgrade your MVC 4 project to MVC 5.

Finally make sure your project has the following ProjectTypeGuids:

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

In MVC5 the option you're looking for might be hidden under the Add Scaffold menu option. See the release blog post for more information on MVC5 scaffolding.


Some information gathered from: http://forums.asp.net/t/1950055.aspx


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...