次の方法で共有


Engine.PreprocessTemplate メソッド

実行コンパイルするときに、テンプレートの出力を生成するテンプレートからコードを生成します。

名前空間:  Microsoft.VisualStudio.TextTemplating
アセンブリ:  Microsoft.VisualStudio.TextTemplating.11.0 (Microsoft.VisualStudio.TextTemplating.11.0.dll 内)

構文

'宣言
Public Function PreprocessTemplate ( _
    content As String, _
    host As ITextTemplatingEngineHost, _
    className As String, _
    classNamespace As String, _
    <OutAttribute> ByRef language As String, _
    <OutAttribute> ByRef references As String() _
) As String
public string PreprocessTemplate(
    string content,
    ITextTemplatingEngineHost host,
    string className,
    string classNamespace,
    out string language,
    out string[] references
)
public:
virtual String^ PreprocessTemplate(
    String^ content, 
    ITextTemplatingEngineHost^ host, 
    String^ className, 
    String^ classNamespace, 
    [OutAttribute] String^% language, 
    [OutAttribute] array<String^>^% references
) sealed
abstract PreprocessTemplate : 
        content:string * 
        host:ITextTemplatingEngineHost * 
        className:string * 
        classNamespace:string * 
        language:string byref * 
        references:string[] byref -> string 
override PreprocessTemplate : 
        content:string * 
        host:ITextTemplatingEngineHost * 
        className:string * 
        classNamespace:string * 
        language:string byref * 
        references:string[] byref -> string 
public final function PreprocessTemplate(
    content : String, 
    host : ITextTemplatingEngineHost, 
    className : String, 
    classNamespace : String, 
    language : String, 
    references : String[]
) : String

パラメーター

  • className
    型 : System.String
    テンプレート コードを受け取るクラスの名前。
  • classNamespace
    型 : System.String
    テンプレート コードが生成される名前空間。
  • language
    型 : System.String%
    生成されるコードの言語。
  • references
    型 : array<System.String[]%
    テンプレートまたはホストによって指定されるアセンブリ。

戻り値

型 : System.String
コンパイルできる文字列。

実装

ITextTemplatingEngine.PreprocessTemplate(String, ITextTemplatingEngineHost, String, String, String%, array<String[]%)

解説

詳細については、「T4 テキスト テンプレートを使用した実行時テキスト生成」および「カスタム ホストを使用したテキスト テンプレートの処理」を参照してください。

ヒントヒント

Visual Studio内で実行されるパッケージまたは拡張機能を作成する場合は、独自のホストを作成するのではなく、テキスト テンプレート サービスを使用することを検討してください。詳細については、「VS 拡張機能内でのテキスト変換の呼び出し」を参照してください。

.NET Framework セキュリティ

  • 直前の呼び出し元に対する完全な信頼。このメンバーは、部分的に信頼されているコードから使用することはできません。詳細については、「部分信頼コードからのライブラリの使用」を参照してください。

参照

関連項目

Engine クラス

Microsoft.VisualStudio.TextTemplating 名前空間