Create a precompiled resource package
Resource packages in Sitefinity CMS contain Razor templates. The templates are used for rendering views of MVC widgets. The templates in the resource packages are compiled when the corresponding widget is rendered. Because of this, there is a delay of several seconds before a widget is rendered for the first time while the web application is running.
To avoid the initial rendering delay, you can precompile the templates so that they are ready for rendering when the widget is requested. This article describes a process for precompiling resource packages.
Perform the following:
- In Visual Studio, create a new Class Library (.NET Framework) project.
Telerik.Sitefinity.Feather NuGet package.
To do this, in the Package Manager Console, run Install-Package Telerik.Sitefinity.Feather. You can find the latest NuGet packages in the NuGet repository.
- Move the
MVC folder from the resource package, which you want to precompile, to the root of the created project and delete the
- Add the following .NET Framework references:
- Install the following NuGet packages:
- Set the Build Action of all view template items in the project to Embedded Resource.
- Add the following attribute in the
AssemblyInfo that marks the assembly as a resource package assembly:
- Add the resulting assembly in the
bin folder of your Sitefinity web app or reference it inside your Sitefinity web app project.