I have an asp.net core mvc project compiled as a dll:
<OutputType>Library</OutputType>
This project is referenced from a Windows Service project (classic .NET) and hosted inside it. This works well while I don't have views. The problem I have is when I add views which it tries to compile at runtime not finding the references.
What I thought is that, maybe, precompiling the views would fix the issue. But I can't seem to find the way to precompile the views for a "Library" output project.
Is there a way to precompile views for a Library type project in ASP.NET *core?
Update: Some more information. It seems that the targets to precompile the views only work with Exe outputs because they expect to have a .exe and .exe.config files generated; this does not happen for a "Library" project (as it only generates a .dll file) and the building of the .PrecompiledViews.dll fails.
There are as named
View componentsinASP.NET Core. So yes, you can create library with your view components and share them between your UI projects. Check this post for the details - Loading View Components from a Class Library in ASP.NET Core MVC