Engine.PreprocessTemplate Method
Generates code from a template that, when it is compiled and run, will produce the template output.
Namespace: Microsoft.VisualStudio.TextTemplating
Assembly: Microsoft.VisualStudio.TextTemplating.12.0 (in Microsoft.VisualStudio.TextTemplating.12.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
content
Type: System.StringThe content of the template.
host
Type: ITextTemplatingEngineHostA template host, which should implement ITextTemplatingEngineHost.
className
Type: System.StringThe name of the class that you want the template code to have.
classNamespace
Type: System.StringThe 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, String)
Remarks
For more information, see Run-Time Text Generation with 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
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.