0

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

2
  • Does stackoverflow.com/questions/30362156/… work? If so ill mark it as a duplicate Commented Feb 9, 2016 at 11:06
  • @SynerCoder No. I had exactly this code, but now it is broken with 1.0.0-rc1-final. Different issue. See my question for more details Commented Feb 11, 2016 at 23:51

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.