Share via


Engine.PreprocessTemplate Method

Generate code from a template which, when compiled and run, will produce the template output.

Namespace:  Microsoft.VisualStudio.TextTemplating
Assembly:  Microsoft.VisualStudio.TextTemplating.10.0 (in Microsoft.VisualStudio.TextTemplating.10.0.dll)

Syntax

'Declaration
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

Parameters

  • className
    Type: System.String
    The name of the class that you want the template code to have.
  • classNamespace
    Type: System.String
    The namespace in which you want the template code to be generated.
  • language
    Type: System.String%
    The language of the generated code.
  • references
    Type: array<System.String[]%
    Assemblies specified by the template or the host.

Return Value

Type: System.String
A string that can be compiled.

Implements

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

Remarks

For more information, see Run-Time Text Generation by using Preprocessed T4 Text Templates and Processing Text Templates by using a Custom Host.

Tip

If you are writing a package or extension that will run within Visual Studio, consider using the text templating service, instead of writing your own host. For more information, see Invoking Text Transformation in a VS Extension.

.NET Framework Security

See Also

Reference

Engine Class

Microsoft.VisualStudio.TextTemplating Namespace