Today I am going to explain quick learn for usage of Pre-complied view in Sitecore 9XP. Enabling Pre-compiled MVC views gives boost to performance in Azure PaaS environment, it is considered as one of the performance tuning parameter in Sitecore Azure PaaS environment and Sitecore Managed Cloud.
By pre-compiling views you will benefit from the following:
- Compile time checking of errors. Usually, Razor files are compiled when they are first required. By pre-compiling your Razor views you remove the source of runtime bugs.
- Faster load time. The SitecoreRazorViewEngine will start to load your views from an assembly (.dll file) rather than a view (.cshtml file).
- Once the Razor-Generator is Configured for your Visual Studio Solution you can follow below steps
- To enable Razor-Generator Check this link.
Perform the following to pre-compile MVC views:
- Go to the below folder path. wwwroot\youewebsitefolder\App_Config\Sitecore\Mvc
- Here you will find the config file with the name “Sitecore.Mvc.config”
- In this file search for term “<precompilation>”.
- And under <precompilation> node add below configuration highlighted in green. don’t forget to change the name to your assembly name. <precompilation>
<assemblyIdentity name=”Sitecore.Mvc” />
<assemblyIdentity name=”YourAssemblyName” />
Happy Learning Sitecore !!!!