处理文本模板以生成可在运行时调用的源代码。
命名空间:  Microsoft.VisualStudio.TextTemplating.VSHost
程序集:  Microsoft.VisualStudio.TextTemplating.Interfaces.10.0(在 Microsoft.VisualStudio.TextTemplating.Interfaces.10.0.dll 中)
语法
声明
Function PreprocessTemplate ( _
    inputFile As String, _
    content As String, _
    callback As ITextTemplatingCallback, _
    className As String, _
    classNamespace As String, _
    <OutAttribute> ByRef references As String() _
) As String
string PreprocessTemplate(
    string inputFile,
    string content,
    ITextTemplatingCallback callback,
    string className,
    string classNamespace,
    out string[] references
)
String^ PreprocessTemplate(
    String^ inputFile, 
    String^ content, 
    ITextTemplatingCallback^ callback, 
    String^ className, 
    String^ classNamespace, 
    [OutAttribute] array<String^>^% references
)
abstract PreprocessTemplate : 
        inputFile:string * 
        content:string * 
        callback:ITextTemplatingCallback * 
        className:string * 
        classNamespace:string * 
        references:string[] byref -> string 
function PreprocessTemplate(
    inputFile : String, 
    content : String, 
    callback : ITextTemplatingCallback, 
    className : String, 
    classNamespace : String, 
    references : String[]
) : String
参数
- inputFile
 类型:System.String
 用于错误报告引用,要生成的模板文件名。可选。
- content
 类型:System.String
 模板文本。
- callback
 类型:Microsoft.VisualStudio.TextTemplating.VSHost.ITextTemplatingCallback
 可提供将在报告错误时被调用的对象。可选。
- className
 类型:System.String
 要生成的类的名称
- classNamespace
 类型:System.String
 将在其中生成该类的命名空间
- references
 类型:array<System.String[]%
 由程序集指令中的模板引用的程序集的集合。有关更多信息,请参见T4 程序集指令
返回值
类型:System.String
可编译的源代码,并运行生成由模板定义的输出。
备注
此方法在 C# 或Visual Basic 中生成的源代码可以被编译,并可以运行产生模板定义的输出。 通常,您会将源代码纳入应用程序中。
有关更多信息,请参见在 VS 扩展中调用文本转换和使用预处理 T4 文本模板生成运行时文本。
.NET Framework 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。