To write the integration tests more easily, I've put the controllers in another project than the host (the one with the startup). This project has the following files:
|
|-- Controllers
| +-- HomeController.cs
|
+-- Views
+-- Home
+-- Index.cshtml
My startup can find the controller thanks to this solution:
services.AddMvc().AddApplicationPart(typeof(HomeController).Assembly);
However, I didn't find any way to set the path of the views. It seems to be relative to the startup place, and not the controller: when I run the application, I get that error:
InvalidOperationException: The view 'Index' was not found. The following locations were searched:
/Views/Home/Index.cshtml
/Views/Shared/Index.cshtml
/Pages/Shared/Index.cshtml
How to specify that the views are in the same folder that the controllers?