Engine.PreprocessTemplate 方法

基于模板生成代码,该代码在编译和运行时将生成模板输出。

命名空间:  Microsoft.VisualStudio.TextTemplating
程序集:  Microsoft.VisualStudio.TextTemplating.10.0(在 Microsoft.VisualStudio.TextTemplating.10.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
    要在其中生成模板代码的命名空间。
  • 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 命名空间