Something unobvious (or not explicitly found through Google-foo) changed in ASP.NET Core 2.0 as to how it finds views. All views related to the generic route of the area ( "{area:exists}/{controller=Home}/{action=Index}/{id?}") will perform its actions and find the view associated with them, as expected, but if I specify a less general route like "Forums/Recent/{page?}", it will not find the view. I can’t emphasize enough, the code in the controller’s action is triggered, so it correctly uses the route. He is simply not looking for a point of view in the right place. He looks only in shared places:
InvalidOperationException: The view 'Recent' was not found. The following locations were searched:
/Areas/Forums/Views/Shared/Recent.cshtml
/Views/Shared/Recent.cshtml
It does not look in /Areas/Forums/Views/Forum/Recent.cshtml, which by agreement corresponds to the controller.
My controllers are not in the same project as the views, if that matters. Again, the controller action is performed, but it does not even look in the right place for the presentation. It worked correctly in version 1.1.
source
share