问题描述
我正在尝试从VS 2017迁移到Rider ... IDE非常吸引人!
I'm trying to move from VS 2017 into Rider... the IDE is very appealing!
不使用命令行,有没有一种方法可以通过从上下文菜单中添加控制器的时髦方式来搭建控制器,如下所示:
WITHOUT using the command line,is there a way to scaffold a controller in the fashionable way of adding a controller from the context menu, as in here:
推荐答案
不,您没有像VisualStudio那样从类或视图模型中搭建控制器的选项,但是仍然可以右键单击来创建控制器.
No, you do not have the options to scaffold a controller from a class or viewmodel as in VisualStudio, but you still can create a controller with a right click.
尽管它不如Visual Studio时髦,但您可以通过非常类似的方式添加Controller:
Althought it is not as fashionable as VisualStudio, you can add a Controller in a very similar way:
- 右键单击Controller文件夹.
- 在上下文菜单中,选择新建"->控制器".
Rider将为您创建一个简单的Controller结构,如下所示:
Rider will create a simple Controller structure for you like this:
using System.Web.Mvc;
namespace ASPNETMVCApplication.Areas.Admin.Controllers
{
public class Controller1 : Controller
{
// GET
public ActionResult Index()
{
return
View();
}
}
}
然后,您可以在View()上 Alt + Enter 并创建一个视图.
Then you can Alt+Enter over the View() and create a view.
但是在这种情况下,它离VisualStudio提供的选项还很远.
But it is still far away from the options VisualStudio offers in this situation.
车手版本:骑士2017.1.1Build#RD-171.4456.2813,建于2017年8月22日
Rider version:Rider 2017.1.1Build #RD-171.4456.2813, built on August 22, 2017
这篇关于Rider中的脚手架控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!