A new project is unable to find the views for a new Area.
It is trying to find it in the parent Views folder.
A suggested solution is to put .DataTokens.Add("area", "AREANAME")
into the RegisterArea
method.
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"Test_default",
"Test/{controller}/{action}/{id}",
new { action = "Index", id = UrlParameter.Optional }
).DataTokens.Add("area", "Test");
}
However, with this, I'm getting an "An item with the same key has already been added." error.
UPDATE 1: I'm not doing anything fancy on the controller.
public ActionResult Index()
{
return View();
}
UPDATE 2: I just would like to add that I'm also registering components into a Unity container. I don't think this is causing issues, though, because it explicitly states that it is not necessary to register my controllers.