asp-area creates incorrect link
I have an MVC app in which I'm attempting to use areas. I've set up my routing as follows:
app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); routes.MapRoute("AreaRoute", "{area:exists}/{controller=Home}/{action=Index}/{id?}"); });
When creating a link using asp-area (<a asp-route-area="MyArea" asp-controller="Home" asp-action="Index">Visit my area</a>), rather than creating http://localhost/MyArea, it creates http://localhost/?area=MyArea which does not work. I've tried replacing asp-area with asp-route-area in the link and get the same result. I've also tried explicitly specifying the area when defining the route rather than using {area:exists} and still get the same result.
I've uploaded a sample project that demonstrates this at https://github.com/82dsoldier/AreaRouteRepo
Sorry to have wasted your time. I just found out that when supplying an area route, it has to go above the default route in order for it to work. It's listed this way in https://github.com/aspnet/Mvc/issues/3665, but it doesn't seem to be mentioned specifically that order is important.