FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Package comparison · adoconnection/RazorEngineCore Wiki · GitHub

Repository navigation

Alexander Selishchev edited this page Oct 22, 2026 · 8 revisions

Based on issue https://github.com/adoconnection/RazorEngineCore/issues/58. Data as of October 2026: package metadata from NuGet and GitHub, Razor features checked with small .NET 10 test apps against the latest package versions.

All improvements are welcome!

TL;DR

  • RazorEngineCore — lightweight runtime engine: templates are plain strings (from files, database, user input), compiled templates can be saved to a file or stream and loaded back, can be unloaded from memory. No ASP.NET Core dependency. Minimalistic by design: HTML encoding, @Include, @Layout are a few lines of your own code (see wiki), no @section, @model, @inject or tag helpers.
  • RazorLight — most downloaded, richest Razor feature set (layouts, sections, includes, encoding by default), but no release since January 2023, depends on ASP.NET Core MVC packages and requires PreserveCompilationContext.
  • RazorEngine.NetCore — .NET Core port of the classic Antaris RazorEngine. Targets netcoreapp3.1 / netstandard2.1, synchronous API only, issue tracker disabled.
  • Razor.Templating.Core — renders regular MVC views (.cshtml in your project or a Razor Class Library) outside of controllers. Full MVC feature set, but templates must exist at build time: no templates from strings or database.

Project status

RazorEngineCore RazorLight RazorEngine.NetCore Razor.Templating.Core
Latest release 2026.1.1 (Jan 17, 2026) 2.3.1 (Jan 16, 2023) 3.1.1 (Dec 9, 2025) 3.1.0 (Feb 22, 2026)
Last commit Oct 2026 Jul 2024 Dec 2025 Feb 2026
NuGet downloads ~9.4M ~38.6M ~23.8M ~9.0M
GitHub stars 645 1,664 122 383
License MIT Apache-2.0 Apache-2.0 MIT
Target frameworks netstandard2.0, net5.0 – net10.0 netstandard2.0, netcoreapp3.1, net5.0, net6.0 netstandard2.1, netcoreapp3.1 net10.0
Dependencies Razor.Language + Roslyn only ASP.NET Core MVC Razor packages, Microsoft.AspNetCore.App framework reference Razor.Language + Roslyn Microsoft.AspNetCore.App framework reference, Razor SDK
Extra project settings none PreserveCompilationContext required none views must be in the project or a Razor Class Library
Issue tracker open open disabled open

Templates and compilation

RazorEngineCore RazorLight RazorEngine.NetCore Razor.Templating.Core
Templates from string / database at runtime ✅ ✅ ✅ ❌ build time only
Templates from files, embedded resources read them yourself and pass a string ✅ built-in projects ✅ built-in template managers ✅ project views
Save / load compiled template ✅ file or stream compiled dll cache in a directory ❌ not needed, views are precompiled
Caching your own (example) memory or file system provider memory not needed
Unload compiled templates from memory ✅ EnableUnloading() (2026.10.1+) ❌ ❌ not needed
Async API ✅ ✅ async only ❌ sync only ✅
Template debugging ✅

Razor features

RazorEngineCore RazorLight RazorEngine.NetCore Razor.Templating.Core
HTML encoding by default ❌ few lines of code ✅ ✅ ✅
@Raw few lines of code ✅ ✅ @Html.Raw
Layouts few lines of code ✅ ✅ ✅
Includes / partials few lines of code ✅ ✅ ✅
@section ❌ ✅ ❌
@model ❌ use @inherits ✅ ❌ ✅
@inject ❌ use template base compiles, open issues ❌ ✅
@functions ✅ ✅ needs extra configuration
Tag helpers ❌ ❌ ❌ ✅
Strongly typed model ✅ RazorEngineTemplateBase<T> ✅ ✅ ✅
Anonymous / ExpandoObject model ✅ ✅ ✅

Empty cell — not checked.

Notes

RazorEngineCore

  • Philosophy: small core, everything else is a template base class you control. HTML encoding, @Raw, @Include, @Layout, localization are implemented in user code, examples are in this wiki.
  • Templates are not encoded by default — remember to use HtmlSafeTemplate when rendering user data into HTML.

RazorLight

  • Every render fails with "Can't load metadata reference from the entry assembly" unless <PreserveCompilationContext>true</PreserveCompilationContext> is set in the project.
  • An engine project has to be configured even for string templates.
  • Single-file publish is not supported (issue #429), README lists AWS Lambda and Azure Functions as not supported.
  • Compiled templates are loaded into the default AssemblyLoadContext and stay in memory until the process exits.

RazorEngine.NetCore

  • Fork chain Antaris/RazorEngine → hermanho → fouadmess, README and docs are inherited from the original project, some described features (@model) don't work on .NET Core.
  • Every compilation writes .cs, .dll and .pdb files to %TEMP%\RazorEngine_* and these folders may be left behind.
  • No async API, issues can't be reported (issue tracker is disabled).

Razor.Templating.Core

  • Uses MVC view engine, so it is a good fit when templates are part of your application and you want full MVC features (tag helpers, view components, _ViewStart, _ViewImports).
  • Rendering templates stored in a database or edited at runtime is not supported.

Other options

  • HtmlRenderer (Microsoft.AspNetCore.Components.Web, .NET 8+) — renders Blazor .razor components to HTML outside of ASP.NET Core, Microsoft lists e-mails and static content as intended use. Components are compiled at build time.
  • RazorSlices — lightweight build-time Razor templates for ASP.NET Core minimal APIs, pre-1.0.

Wiki pages Pages 12

Clone this wiki locally


Back | FazBrowse Home | New Git URL