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 project.
- Install
Telerik.Sitefinity.FeatherNuGet package.
To do this, in the Package Manager Console, runInstall-Package Telerik.Sitefinity.Feather. You can find the latest NuGet packages in the NuGet repository. - Move the
MVCfolder from the resource package, which you want to precompile, to the root of the created project and delete theResourcePackagesfolder. - Add the following .NET Framework references:
System.Runtime.SerializationSystem.Web.ApplicationServicesSystem.Web.Extensions
- Install the following NuGet packages:
Install-Package Telerik.Sitefinity.CoreInstall-Package Telerik.Sitefinity.ServicesImplInstall-Package ServiceStack.Text
- Set the Build Action of all view template items in the project to Embedded Resource.
- Add the following attribute in the
AssemblyInfothat marks the assembly as a resource package assembly:
[assembly: Telerik.Sitefinity.Frontend.Mvc.Infrastructure.Controllers.Attributes.ResourcePackage("Bootstrap")] - Add the resulting assembly in the
binfolder of your Sitefinity web app or reference it inside your Sitefinity web app project.
Want to learn more?
Enhance your Sitefinity skills by enrolling in free training sessions. Become Sitefinity certified through Progress Education Community to strengthen your professional credentials.
Get started with Integration Hub | Sitefinity Cloud
This free lesson teaches administrators, marketers, and other business professionals how to use Sitefinity Integration Hub to create automated workflows between Sitefinity and other business systems.
Web Security for Sitefinity Administrators
This free lesson teaches administrators the basics about protecting your Sitefinity instance and your sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.
Foundations of Sitefinity ASP.NET Core Development
The free on-demand video course teaches developers how to use Sitefinity ASP.NET Core and take advantage of its decoupled architecture and modern development model.