如何在ASP.NET MVC6 beta5的项目中添加控制器? [英] How can add controller in ASP.NET MVC6 beta5 project?

查看:210
本文介绍了如何在ASP.NET MVC6 beta5的项目中添加控制器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是安装的Visual Studio 2015 最终版本,并创建 mvc6 beta5的项目(默认模板)。
试图添加控制器作为MVC 5.2 (也vs2015最终版):

i'm install Visual Studio 2015 final release and create mvc6 beta5 project (by default template). Trying add controller as in mvc 5.2 (also in vs2015 final release):

不过,在 mvc6 beta5的此项目菜单中缺少:

but, in mvc6 beta5 project this menu missing:

1。怎么解决这个问题?

UPD

2。是否有可能增加mvc6控制器产生看法?

2. Is it possible add mvc6 controller with generate views?

推荐答案

在此之前MVC 6.0 MVC控制器的概念,一个Web API控制器是有所不同的。对于未经训练的眼睛,他们看起来相似,但他们确实表现不同,用了不同的班级。

Prior to MVC 6.0 the notion of an MVC Controller and a Web API Controller were somewhat different. To the untrained eye, they looked similar but they did behave differently and were using different classes.

因此​​,为什么当你点击控制器... 选项,你有一个MVC控制器和/或Web API控制器之间进行选择的能力。

Hence why when you clicked the Controller… option, you had the ability to choose between an MVC Controller and/or a Web API Controller.

由于MVC 6.0,现在无论MVC和Web API控制器已统一。他们现在完全一样的东西,并使用相同的类。

As of MVC 6.0, both MVC and Web API controllers have now been unified. They are now exactly the same thing and are using the same classes.

所以,你真的没有需要一个MVC控制器和一个Web API控制器之间进行选择。

So you don’t really have the need to choose between an MVC Controller and a Web API Controller.

只需单击添加新项这反过来将打开Add New Item对话框。

Simply click the Add New Item which in turn will open the Add New Item dialog.

从右上角的搜索文本框中添加新项对话框中,输入的控制器

From the Add New Item dialog in the top right search textbox, enter Controller.

您将能够选择 MVC控制器类模板。

谁知道......也许他们所附带的最终产品的时候,他们就会把它带回来,但至少从目前来看,这不应该是一个显示塞。

Who knows...maybe by the time they ship the final product, they’ll bring it back but at least for now, this shouldn’t be a show stopper.

编辑:
对于脚手架的东西,也许这的链接可能的帮助。

这篇关于如何在ASP.NET MVC6 beta5的项目中添加控制器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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