问题
I'd like to get started with ASP.NET MVC 5 using Visual Studio 2012. I've installed the "ASP.NET And Web Tools 2013 for Visual Studio 2012, but this "only" gives me an "Empty ASP.NET MVC 5 Project" template.
For MVC4 web projects, I can select different kinds of Web applications (like "Standard", "Internet", "Intranet" etc.). And I've seen screenshots with similar options for Visual Studio 2013.
Are there any project templates (for VS2012) which allow me to do the same for MVC5 applications?
回答1:
It seems that "currently" there is only included the Empty Project template, and MS officially hasn't released all other templates for VS2012. For ASP.NET MVC 5 you can use the scafolding to add the Controllers, Views etc. This is the same for WebAPI templates.
ASP.NET MVC 5 template
We added a new MVC 5 template. It references the latest MVC 5 NuGet packages, and you can use scaffolding to add controllers and views.
Also see the RELEASE NOTES
回答2:
Not sure if you are interested in this answer, but I have a tutorial that will not only get your empty MVC 5 project working with Bundling, a controller, jQuery, jQuery UI, Modernizr and more, but it will walk you through installing Zurb's Foundation 5, a responsive Framework which I have working with Sass in MVC 5. It's all here:
http://httpjunkie.com/2013/158/install-zurbs-foundation-5-in-net-mvc-5/
The problem many have ran into is that Visual Studio 2012 only allows you to start from a blank MVC 5 project, so I will help you get the NuGet installed which is pretty similar to the instructions in the NuGet package with a few minor changes; however, it does not take into consideration that you will be installing from Visual Studio 2012 using a Blank MVC 5 project. If you would like to use Foundation 5 with MVC 4 Web Application template just omit the Bootstrap uninstall and the NuGet package should work fine, but if you need to use MVC 5 and you don’t have Visual Studio 2013, you will need to build the Home Controller, Bundling class, modify the Global.asax.cs as well as other quirky little things. So lets get started.
I spent a good part of a few hours getting it all working.
回答3:
I just ran across this and going through it now. It seems to be spot on as well as really answering the posters question.
http://httpjunkie.com/2013/340/develop-mvc-5-with-asp-net-identity-in-visual-studio-2012/
回答4:
Use VS2013 express, which has the latest templates, generate the scaffolded project (not empty), then go back to VS2012 and do your work.
来源:https://stackoverflow.com/questions/20160683/mvc5-project-template-for-visual-studio-2012