asp.net-mvc 在 VS 2012 中创建和运行 MVC 5 项目
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17968304/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Create and Run MVC 5 Project in VS 2012
提问by Alireza Noori
For some reason my Visual Studio 2013 Preview cannot create MVC 5 Projects. Since the MVC project is now open source in CodePlex I was wondering if there's a simple way to develop MVC 5 projects in my Visual Studio 2012 Ultimate.
出于某种原因,我的 Visual Studio 2013 Preview 无法创建 MVC 5 项目。由于 MVC 项目现在在 CodePlex 中是开源的,我想知道是否有一种简单的方法可以在我的 Visual Studio 2012 Ultimate 中开发 MVC 5 项目。
采纳答案by Natan
A new tutorial has been recently added to the ASP.NET website on how to upgrade an MVC4 project to MVC5.
最近向 ASP.NET 网站添加了一个关于如何将 MVC4 项目升级到 MVC5的新教程。
I migrated a VS 2012 project using this tutorial without problems, but there is no design time support for Razor 3 in VS2012 due to changes in the way VS loads the razor engine.
我使用本教程迁移了一个 VS 2012 项目没有问题,但由于VS 加载剃刀引擎的方式发生了变化,VS2012 中没有对 Razor 3 的设计时支持。
You can edit razor pages in VS2012, but it will be a plain HTML editor.
您可以在 VS2012 中编辑 razor 页面,但它将是一个普通的 HTML 编辑器。
回答by Kna?is
Microsoft has released updated Web Tools 2013.1 that provide the support:
Microsoft 已发布更新的 Web Tools 2013.1,提供以下支持:
Note that I had to install it manually from the second link, the tools did not install properly from Web Platform Installer. Also a colleague had to install both Update 4 and these tools to get proper support.
请注意,我必须从第二个链接手动安装它,这些工具没有从 Web 平台安装程序正确安装。还有一位同事必须同时安装 Update 4 和这些工具才能获得适当的支持。
原始答案(不再实际):
I received this answer from Microsoft developer:
我从微软开发人员那里收到了这个答案:
MVC 5/Razor 3 tooling support for VS 2012 has not shipped yet. We hope to ship this support in Mid November.
对 VS 2012 的 MVC 5/Razor 3 工具支持尚未发布。我们希望在 11 月中旬提供此支持。
Recently ASP.NET Program Manager from Microsoft mentioned in a talk that this would be included in VS2012 Update 4.Edit: unfortunately the support is not in Update 4.
最近微软的 ASP.NET 程序经理在一次演讲中提到这将包含在 VS2012 Update 4 中。编辑:不幸的是,支持不在更新 4 中。
So the accepted answer is true for now but we can plan to soon have this support in VS2012 as well.
所以目前公认的答案是正确的,但我们可以计划很快在 VS2012 中也提供这种支持。
回答by Aaron Stainback
Microsoft has released an update for this, Web Tools 2013.1 for VS2012.
Microsoft 已经为此发布了一个更新,即 Web Tools 2013.1 for VS2012。
回答by user965445
I'm not sure MS will fix it.
我不确定 MS 会修复它。
The bug report says problem closed : by design
错误报告说问题已关闭:设计使然
and it is mid November
现在是十一月中旬
回答by Eric Bishard
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:
我有一个教程,它不仅可以让您的空 MVC 5 项目与 Bundling、控制器、jQuery、jQuery UI、Modernizr 等一起工作,而且还将引导您安装 Zurb 的 Foundation 5,这是我与 Sass 合作的响应式框架在 MVC 5 中。一切都在这里:
http://tinyurl.com/VS12-MVC5-F5
http://tinyurl.com/VS12-MVC5-F5
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.
许多人遇到的问题是 Visual Studio 2012 只允许您从一个空白的 MVC 5 项目开始,因此我将帮助您安装 NuGet,这与 NuGet 包中的说明非常相似,但有一些小的更改;但是,它没有考虑到您将使用 Blank MVC 5 项目从 Visual Studio 2012 进行安装。如果您想将 Foundation 5 与 MVC 4 Web 应用程序模板一起使用,只需省略 Bootstrap 卸载,NuGet 包应该可以正常工作,但是如果您需要使用 MVC 5 而您没有 Visual Studio 2013,则需要构建Home Controller,Bundling 类,修改 Global.asax.cs 以及其他古怪的小东西。所以让我们开始吧。
I spent a good part of a few hours getting it all working.
我花了几个小时的大部分时间来让它全部工作。

