I have followed the following link to use a Razor style syntax with my email templates;
Microsoft Code Razorlight Tutorial
I have implemented a static helper class for getting my templates.
public static string GetTraderApplicationDeletedTemplate(Trader trader)
{
string templatePath = $@"{Directory.GetCurrentDirectory()}\EmailTemplates";
IRazorLightEngine engine = EngineFactory.CreatePhysical(templatePath);
string result = engine.Parse("TraderDeletedEmail.cshtml", trader);
return result;
}
However, when debugging the engine.Parse method is throwing a System.TypeLoadException with no further detail?
Now the templatePath is valid (as is the file name .cshtml)? Does anyone have any ideas on what could be causing this error?