Transforms the contents of a text template file to produce the generated text output.
Namespace:
Microsoft.VisualStudio.TextTemplating Assembly:
Microsoft.VisualStudio.TextTemplating (in Microsoft.VisualStudio.TextTemplating.dll)
Visual Basic (Declaration)
Public Function ProcessTemplate ( _
content As String, _
host As ITextTemplatingEngineHost _
) As String
Dim instance As Engine
Dim content As String
Dim host As ITextTemplatingEngineHost
Dim returnValue As String
returnValue = instance.ProcessTemplate(content, _
host)
public string ProcessTemplate(
string content,
ITextTemplatingEngineHost host
)
public:
virtual String^ ProcessTemplate(
String^ content,
ITextTemplatingEngineHost^ host
) sealed
public final function ProcessTemplate(
content : String,
host : ITextTemplatingEngineHost
) : String
Parameters
- content
- Type: System..::.String
The contents of the text template file to be transformed.
- host
- Type: Microsoft.VisualStudio.TextTemplating..::.ITextTemplatingEngineHost
The ITextTemplatingEngineHost that will host this engine.
Return Value
Type: System..::.String
The generated text output of the text template file.
Implements
ITextTemplatingEngine..::.ProcessTemplate(String, ITextTemplatingEngineHost)
| Exception | Condition |
|---|
| ArgumentNullException | content is nullNothingnullptra null reference (Nothing in Visual Basic). -or- host is nullNothingnullptra null reference (Nothing in Visual Basic). |
In Visual Studio, if a file has its Custom Tool property set to TextTemplatingFileGenerator, then clicking Run Custom Tool in the user interface corresponds to calling ProcessTemplate to transform the template.
For more information, see How to: Create Text Templates.
The following example demonstrates how to create an instance of the Engine, and calling ProcessTemplate to transform a text template.
This code example is part of a larger example provided for the ITextTemplatingEngineHost interface.
Engine engine = new Engine();
//read the text template
string input = File.ReadAllText(templateFileName);
//transform the text template
string output = engine.ProcessTemplate(input, host);
Dim engine As Engine = New Engine()
'read the text template
Dim input As String = File.ReadAllText(templateFileName)
'transform the text template
Dim output As String = engine.ProcessTemplate(input, host)
Concepts
>About Text Template Hosts
Reference