What's the current best solution for generating HTML from ASP.NET Razor templates within a Console Application?

Scott Hanselman picture Scott Hanselman · Jan 9, 2013 · Viewed 12.2k times · Source

I want to do this:

string template = "Hello @Model.Name! Welcome to Razor!";
string result = Razor.Parse(template, new { Name = "World" });

And it appears that http://razorengine.codeplex.com is perfect, except it's a year old.

EDIT: Turns out that RazorEngine has moved to GitHub and had a commit a few months back: https://github.com/Antaris/RazorEngine

I noticed that Service Stack has some Razor self-hosting but while there's a long page here http://razor.servicestack.net there's no "hello world you can totally do this from a console."

What's the current best solution for generating HTML from ASP.NET Razor templates within a Console Application?

Answer

Darin Dimitrov picture Darin Dimitrov · Jan 9, 2013

What's the current best solution for generating HTML from ASP.NET Razor templates within a Console Application?

RazorEngine. Full stop.