I have an console application targeting .NET 4.7.2 with SDK Microsoft.NET.Sdk.Web and using MVC Core 2.2. What i want to achieve is to have the views to be precompiled BUT with an ability to override them with custom cshtml files when required.
As i understand in order to be able to achieve that i will need to have PreserveCompilationContext to be set to true in my project file. Also in order to have compilation dependencies (ref folder) to be generated on publish i will need to have CopyRefAssembliesToPublishDirectory set to true. This will cause an ref folder to be generated with required compilation dependencies and the deps.json configuration file.
So my questions are
- For the deployment i will need to include both deps.json and refs folder along with my application, based on my observation if those are not included and cshtml file is present in views directory compilation fails.
- Is there a way to generate compilation dependencies on build instead of publish ?
- Is there anything i should be aware of in terms of how this could affect precompiled views rendering?
In general i am just trying to figure if i am making correct steps to achieve the desired behaviour.
Thanks!