ITextTemplatingEngineHost Interface
The interface for the host that transforms text templates. This is available to directive processors and can also be accessed by text templates.
Namespace: Microsoft.VisualStudio.TextTemplating
Assembly: Microsoft.VisualStudio.TextTemplating.Interfaces.10.0 (in Microsoft.VisualStudio.TextTemplating.Interfaces.10.0.dll)
Syntax
'Declaration
<CLSCompliantAttribute(True)> _
Public Interface ITextTemplatingEngineHost
[CLSCompliantAttribute(true)]
public interface ITextTemplatingEngineHost
[CLSCompliantAttribute(true)]
public interface class ITextTemplatingEngineHost
[<CLSCompliantAttribute(true)>]
type ITextTemplatingEngineHost = interface end
public interface ITextTemplatingEngineHost
The ITextTemplatingEngineHost type exposes the following members.
Properties
Name | Description | |
---|---|---|
StandardAssemblyReferences | Gets a list of assembly references. | |
StandardImports | Gets a list of namespaces. | |
TemplateFile | Gets the path and file name of the text template that is being processed. |
Top
Methods
Name | Description | |
---|---|---|
GetHostOption | Called by the Engine to ask for the value of a specified option. Return null if you do not know. | |
LoadIncludeText | Acquires the text that corresponds to a request to include a partial text template file. | |
LogErrors | Receives a collection of errors and warnings from the transformation engine. | |
ProvideTemplatingAppDomain | Provides an application domain to run the generated transformation class. | |
ResolveAssemblyReference | Allows a host to provide additional information about the location of an assembly. | |
ResolveDirectiveProcessor | Returns the type of a directive processor, given its friendly name. | |
ResolveParameterValue | Resolves the value of a parameter for a directive processor if the parameter is not specified in the template text. | |
ResolvePath | Allows a host to provide a complete path, given a file name or relative path. | |
SetFileExtension | Tells the host the file name extension that is expected for the generated text output. | |
SetOutputEncoding | Tells the host the encoding that is expected for the generated text output. |
Top
Remarks
A host takes a text template file as the input and produces a text file as output. A typical host is the TextTemplatingFileGenerator tool that transforms templates in a Visual Studio project. It calls one or more directive processors to deal with different types of template. The members of this interface are accessible to the directive processors, and to the code of the text template. The text template engine controls this process and interacts with a host and one or more directive processors. To learn more about these components, see Code Generation and T4 Text Templates.
To make the host accessible to the code of a text template, set the hostspecific parameter of the template directive. For example:
<#@template language="c#" hostspecific="true" #>
<# // This template is specific to the TextTemplatingFileGenerator host,
// which transforms templates in a Visual Studio project. #>
These are the projects in this solution:
<#=this.Host.ResolveParameterValue("-", "-", "projects") #>
If you want to use text templates outside Visual Studio or with custom tools, you can write a custom host, implementing this interface. For an example, see Walkthrough: Creating a Custom Text Template Host.
See Also
Reference
Microsoft.VisualStudio.TextTemplating Namespace