2017-03-03 11 views
1

現在、RazorEngineライブラリを使用してhtml電子メールテンプレートを作成しています。コード:テンプレート自体以内RazorEngineを使用するときに名前空間を追加する

var result = Engine.Razor.RunCompile(File.ReadAllText(templateFilePath), key, typeof(T), data); 

私はすなわち@Html.Format(string string);

、MVCが提供するヘルパーメソッドの一部へのアクセスを取得したいが、私は、テンプレート内のコードの言った行を追加するときは、次のとおりです。

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

私は正しい名前空間を参照する必要があると説明しています。質問は、私は何を参照し、どこに?

+0

解決方法が見つかりましたか? – Sidron

答えて

関連する問題