cofoundry
cofoundry copied to clipboard
View Pre-compilation: Remove the need for special settings
As per #105 view pre-compilation is supported with a couple of config settings, but it may be possible to reduce the friction here.
Firstly we may be able to use the same magic that the MvcPrecompilation project uses to create a page template and block type metadata file at build time that we can rely on to always be there no matter what pre-compilation options have been set.
Secondly we may be able to compile views in the Cofoundry package assemblies to avoid the need for the MvcRazorExcludeRefAssembliesFromPublish
setting as demonstrated in this example ClassLibraryWithPrecompiledViews project.
Note that work is being done by the asp.net team to improve support for view compilation in class libraries, see razor issue 1809
ASP.NET Core 2.1 has introduced the Razor SDK that can be used to embed views in an assembly. It's not immediately clear to me if this will fix any of our issues directly as there's not great detail in the documentation at present and might take some digging and experimentation to work out how exactly a project needs to be setup and what changes need to be made to our file provider to enable the views. Here's some resources that may be useful:
- Microsoft.AspNetCore.Identity.UI Project
- A ManifestEmbeddedFileProvider has been added. This could be useful in improving the handling of special characters in embedded resource file names