Last Updated: February 25, 2016
· analogj

RazorEngine Html.Raw fix

While working on our cloud ebook manager QuietThyme, we looked into creating an emailing system that would allow myself and the other founders of QuietThyme to send emails immediately while also keeping a consistent and professional look.
To that end we began integrating RazorEngine, an open source templating engine based on Microsoft's Razor parsing engine that you can extend very easily to become an email templating system

One of the problems that we ran into during our integration was that any use of @Html.Raw("html string here") would result in an error "Unable to compile template. The name 'Html' does not exist in the current context".

The solution for this problem was found in a github issue and I thought it could be helpful to another developer attempting to use RazorEngine with @Html.Raw() to give it a bit more publicity.

@(new RawString("<strong>Bold!</strong>"))

Or, just use:

Say Thanks

2 Responses
Add your response


Only problem with this is I don't get any intellisense for @Raw. I don't know if that's just a configuration issue on my part - but if so, what did I do wrong!? ;)

over 1 year ago ·

Thank you, this was killing me.

over 1 year ago ·