I have a razor markup as a string and I am trying to render it to HTML programmatically. I used to use RazorEngine (https://github.com/Antaris/RazorEngine) library, but it doesn't seem to work with ASPNET 5 "1.0.0-rc1-final" as it relies on older version of Razor. I am loading my view from another dll as a string resource. All I need is to convert Razor to HTML. Is there a way to do it, I am sure there is out-of-the-box solution. Most sample online are using file path for razor view, but in my case I have string.

I am getting this exception when running:

var content = RazorEngine.Engine.Razor.RunCompile(templateContent, System.Guid.NewGuid().ToString(), null, model);

Method not found: 'Void Microsoft.AspNet.Razor.CodeGenerators.GeneratedClassContext.set_ResolveUrlMethodName(System.String)'

Used to work with AspNet 4.0.0-beta8

Related posts

Recent Viewed