Fix compiler issue when no Razor view is compiled

  • Updated

This article is subjected to CMS 12 and Net Core platform.

Symptom

All pages return with the error like this:

The view 'Index' was not found. The following locations were searched:
/Features/Shared/ElementBlocks/Index.default.sv.cshtml
/CmsDefault/Features/Shared/ElementBlocks/Index.default.sv.cshtml
/Features/Shared/ElementBlocks/Index.default.cshtml
/CmsDefault/Features/Shared/ElementBlocks/Index.default.cshtml

When viewing the compiled DLL, there's no generated code under the namespace "AspNetCoreGeneratedDocument" where all Razor views are compiled.

 

Resolve the problem

Remove the package dependency Microsoft.Net.Compilers.Toolset from all CSPROJ files in your code projects.

After rebuilding the code solution, all CSHTML files are compiled and added to the assembly: