I am currently using the RazorEngine library to create html Email templates. Code:
var result = Engine.Razor.RunCompile(File.ReadAllText(templateFilePath), key, typeof(T), data);
Within the template itself I want to get access to some of the helper methods provided by MVC, namely @Html.Format(string string);
However Whenever I add said line of code in the template is:
Errors while compiling a Template. Please try the following to solve the situation: * If the problem is about missing/invalid references or multiple defines either try to load the missing references manually (in the compiling appdomain!) or Specify your references manually by providing your own IReferenceResolver implementation. See https://antaris.github.io/RazorEngine/ReferenceResolver.html for details. Currently all references have to be available as files! * If you get 'class' does not contain a definition for 'member': try another modelType (for example 'null' to make the model dynamic). NOTE: You CANNOT use typeof(dynamic) to make the model dynamic! Or try to use static instead of anonymous/dynamic types. More details about the error: - error: (180, 97) The name 'Html' does not exist in the current context
Which does explain that I need to reference the right namespace. Question is, what do I reference and where?