Engine.PreprocessTemplate 方法

会从模板的代码,程序中,当编译和运行时,将产生模板输出。

命名空间:  Microsoft.VisualStudio.TextTemplating
程序集:  Microsoft.VisualStudio.TextTemplating.12.0(在 Microsoft.VisualStudio.TextTemplating.12.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

参数

  • content
    类型:String

    模板的内容。

  • host
    类型:ITextTemplatingEngineHost

    应实现 ITextTemplatingEngineHost 的模板主机。

  • className
    类型:String

    您希望模板代码具有的类的名称。

  • classNamespace
    类型:String

    要在其中生成模板代码的命名空间。

  • language
    类型:String%

    生成的代码的语言。

  • references
    类型:array<String[]%

    由模板或主机指定的程序集。

返回值

类型:String
可以编译的字符串。

实现

ITextTemplatingEngine.PreprocessTemplate(String, ITextTemplatingEngineHost, String, String, String, String)

备注

有关更多信息,请参见使用 T4 文本模板的运行时文本生成使用自定义宿主处理文本模板

提示

如果要编写将在 Visual Studio内运行的包或扩展,请考虑使用文本模板化服务而不是编写您自己的主机。有关详细信息,请参阅在 VS 扩展中调用文本转换

.NET Framework 安全性

请参阅

参考

Engine 类

Microsoft.VisualStudio.TextTemplating 命名空间