ITextTemplatingComponents Interface
Cast the STextTemplatingservice to this interface to gain access to the components of the text templating service. Use this interface instead of ITextTemplating for advanced scenarios.
This API is not CLS-compliant.
Namespace: Microsoft.VisualStudio.TextTemplating.VSHost
Assembly: Microsoft.VisualStudio.TextTemplating.Interfaces.10.0 (in Microsoft.VisualStudio.TextTemplating.Interfaces.10.0.dll)
Syntax
'Declaration
<CLSCompliantAttribute(False)> _
Public Interface ITextTemplatingComponents
[CLSCompliantAttribute(false)]
public interface ITextTemplatingComponents
[CLSCompliantAttribute(false)]
public interface class ITextTemplatingComponents
[<CLSCompliantAttribute(false)>]
type ITextTemplatingComponents = interface end
public interface ITextTemplatingComponents
The ITextTemplatingComponents type exposes the following members.
Properties
Name | Description | |
---|---|---|
![]() |
Callback | Get or set the error reporting and file extension callback that the host uses. |
![]() |
Engine | Get the text templating engine used by the service. |
![]() |
Hierarchy | Get or set the hierarchy to use to help resolve project references. |
![]() |
Host | Get the singleton Vs Host |
![]() |
InputFile | Get or set the template filename that the host references when reporting errors. Can be null. |
Top
Examples
using Microsoft.VisualStudio.TextTemplating;
using Microsoft.VisualStudio.TextTemplating.VSHost;
...
// Get the main Visual Studio text templating service.
// Notice that we cast to ITextTemplatingComponents instead of ITextTemplating:
ITextTemplatingComponents ttc = serviceProvider.GetService(typeof(STextTemplating)) as ITextTemplatingComponents;
// Create my own templating engine instance:
Engine engine = new Engine();
// Set processing parameters:
ttc.InputFile = "myTemplateFile";
// Process the result using the main VS host:
string result = engine.ProcessTemplate(myTemplateContent, ttc.Host);
// Any errors in myTemplateContent will appear in the VS error window.
// Any error reports will use the filename "myTemplateFile".