Search code examples
c#asp.netasp.net-mvcrazorservicestack

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


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?


Solution

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

    RazorEngine. Full stop.