VS 2012 上没有 ASP.NET MVC 5 Web 应用程序模板? [英] No ASP.NET MVC 5 Web Application Template on VS 2012?

查看:29
本文介绍了VS 2012 上没有 ASP.NET MVC 5 Web 应用程序模板?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 Visual Studio 2012 并且刚刚安装了 "Microsoft ASP.NET 和 Web 框架 2013.1 - Visual Studio".

I'm using Visual Studio 2012 and have just installed "Microsoft ASP.NET and Web Frameworks 2013.1 - Visual Studio".

正如预期的那样,它添加了创建ASP.NET MVC 5 Empty Project"的选项.问题是,我认为没有办法快速启动 已经功能基础应用程序",就像我在使用 MVC 4 时一样(例如 Asp.NET MVC 4 Web 应用程序").我只看到一个空模板.

As expected, it added the option to create an "ASP.NET MVC 5 Empty Project". The thing is, I see no way of jump-starting an already functional "base application" as I had when I was using MVC 4 (e.g. "Asp.NET MVC 4 Web Application"). I only see an empty template.

我看过以下答案:

创建和运行 MVC5 VS 2012 中的项目

用于 VS 2012 的 ASP.NET MVC 5 的直接下载链接

发现这篇关于此事的文章.

这显然不是一个阻碍,因为我总是可以从头开始创建应用程序,但我仍然想知道是否有可能在 VS 2012 上实现.我错过了一步,还是我需要VS 2013呢?一个功能齐全的 Web 应用程序模板(带有身份验证等)很适合用于 MVC 5 的新功能或原型设计.

This is obviously not a show-stopper as I can always create the application from a scratch, but I still would like to know if it is possible to achieve that on VS 2012. Did I miss a step, or do I need VS 2013 for that? A fully functional Web application template (with authentication etc.) would be nice to dabble around MVC 5's new features or for prototyping.

推荐答案

使用ASP.NET MVC 5 Empty Project新建项目后,可以右键点击项目,然后点击添加.. > New Scaffolded Item...,选择左侧的MVC,然后选择MVC 5 Dependencies并选择<提示中的代码>完整依赖项.

After creating a new project using ASP.NET MVC 5 Empty Project, you can right click on the project, then click Add.. > New Scaffolded Item..., select MVC on the left, then MVC 5 Dependencies and choose Full dependencies from the prompt.

这将添加一个默认布局(ViewsShared\_Layout.cshtml)、Content 文件夹、Scripts 文件夹和 bootstrap、jquery、Modernizr 等,以及 Web 应用程序模板创建的其他内容.

This will add a default layout (ViewsShared\_Layout.cshtml), Content folder, Scripts folder with bootstrap, jquery, modernizr, etc, and other things the Web Application template creates.

如果您收到错误CS0103: The name 'Styles' does not exist in the current context",只需在 <add namespace="System.Web.Optimization"/> 下添加<Views/web.config

If you get the error "CS0103: The name 'Styles' does not exist in the current context" just add <add namespace="System.Web.Optimization"/> under <namespaces> in Views/web.config

这篇关于VS 2012 上没有 ASP.NET MVC 5 Web 应用程序模板?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆