Cogito.Web.Razor 4.0.0

dotnet add package Cogito.Web.Razor --version 4.0.0
                    
NuGet\Install-Package Cogito.Web.Razor -Version 4.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Cogito.Web.Razor" Version="4.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Cogito.Web.Razor" Version="4.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Cogito.Web.Razor" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Cogito.Web.Razor --version 4.0.0
                    
#r "nuget: Cogito.Web.Razor, 4.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Cogito.Web.Razor@4.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Cogito.Web.Razor&version=4.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Cogito.Web.Razor&version=4.0.0
                    
Install as a Cake Tool

Cogito.Web.Razor

Compile and run Razor templates outside ASP.NET.

Why

The Razor parser is useful well beyond MVC — generating email bodies, reports, or code — but hosting it yourself means dealing with RazorEngineHost, code generation and compilation by hand. This wraps that into a template you can build and execute.

Install

dotnet add package Cogito.Web.Razor

Use

var template = new RazorTemplateBuilder()
    .Build("Hello, @Model.Name.");

var text = template.Run(new { Name = "World" });

RazorHost is the configured engine host, IRazorTemplate the compiled result. Compilation and parse failures surface as CompilerErrorException and ParserErrorException rather than as an error collection you have to inspect.

Targets .NET Framework.

License

MIT.

Product Compatible and additional computed target framework versions.
.NET Framework net472 is compatible.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Cogito.Web.Razor:

Package Downloads
Cogito.Web.UI.Razor

Provides objects to use Razor for WebForms

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.0.0 115 10/15/2026
3.1.37 126 9/14/2026
3.1.36 946 11/30/2020
3.1.35 697 11/16/2020
3.1.34 772 11/16/2020
3.1.30 862 11/15/2020
3.1.29 817 11/11/2020
3.1.27 719 11/11/2020
3.1.26 744 11/11/2020
3.1.24 759 11/11/2020
3.1.23 960 11/11/2020
3.1.20 907 11/11/2020
3.1.18 799 8/7/2020
3.1.16 818 8/7/2020
3.1.13 1,002 2/25/2020
3.1.10 864 2/25/2020
3.1.8 850 2/25/2020
3.1.7 905 2/25/2020
3.1.6 893 2/25/2020
3.0.11 826 2/7/2020
Loading failed