.net core MVC web项目中,已经设置了能够在Controllers、Views文件夹下建立子文件夹的路由规则和视图寻找路径扩展规则,现在网页中可以正常访问到子文件下的视图,但是VS中不能通过右键Action的方式创建视图到对应控制器的文件夹、不能右键Action跳转到对应控制器下视图,请问各位大神有没有办法能够实现???新手请教
Startup类中添加的代码如下:
ConfigureServices中:
services.AddMvc(options => options.EnableEndpointRouting = false);
services.Configure<RazorViewEngineOptions>(opt =>
{
//扩展视图查找路径
opt.ViewLocationFormats.Add("~/Views/SetsAndBasicData/{1}/{0}" + RazorViewEngine.ViewExtension);
opt.ViewLocationFormats.Add("~/Views/HumanResource/{1}/{0}" + RazorViewEngine.ViewExtension);
});
Configure中:
app.UseMvc(routes =>
{
//扩展控制器路由规则
routes.MapRoute(/*人力资源*/
name: "HumanResource",
template: "HumanResource/{controller}/{Action}/{id?}"
);
routes.MapRoute(/*系统设置和基础数据*/
name: "SetAndBasicData",
template: "SetAndBasicData/{controller}/{Action}/{id?}"
);
}
求各位大佬解惑