You need to tell the compilation services the mapping of the class library to the folder that contains the razor files. See section on razor libraries.
View page from ProjectReference not reflected without restarting main project ASP.Net MVC
Tien Dang
81
Reputation points
I am building a shared UI - razor page in a Lib project (Visual Studio), the purpose is to add the Lib project as ProjectReference to multiple places. I am stuck at finding a way to reflect the .cshtml changes immediately to the browser without restart the main project, which waits me a lot of time.
services.AddMvc().AddRazorRuntimeCompilation();
Setup line above works when I coded UI in main project, but Lib project doesn't.
More information: .Net5.0, Asp.net MVC, Razor page.