I have an ASP .Net MVC5 website, I have performance issues, I want to pre-compile the razor views and exclude them when deploying my website in IIS, I followed the steps indicated in this article but I got an error : RazorGenerator.targets was not found, in fact I checked in the package folder I din't find this file. Do you have any idea why this dll not found in the package folder ? The RazorGenerator.Mvc and RazorGenerator.MsBuild are installed correctly. Thanks in advance
Razor View Engine is a markup syntax which helps us to write HTML and server-side code in web pages using C# or VB.Net. It is server-side markup language however it is not at all a programming language.
cshtml extension are compiled at both build and publish time using the Razor SDK. Runtime compilation may be optionally enabled by configuring your project.
You can add support for Pages to any ASP.NET Core MVC app by simply adding a Pages folder and adding Razor Pages files to this folder.
You just need to check “Enable Razor runtime compilation” when you're creating a new project. Moreover, this option is available when choosing the target framework starting from version 3.1 to the current version 5. x. Remember these when you are creating a new ASP.NET Core or ASP.NET Core MVC projects.
You don't need RazorGenerator for this. When publishing just set the option to "Precompile during publishing", under "File Publish Options" on the "Settings" tab. Click "Configure" and then tick "Merge all outputs to a single assembly". Give it a unique name, generally something like [ProjectName].Precompiled
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With