ITextTemplatingEngineHost.TemplateFile Property

Gets the path and file name of the text template that is being processed.

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

Syntax

'Declaration
ReadOnly Property TemplateFile As String
string TemplateFile { get; }
property String^ TemplateFile {
    String^ get ();
}
abstract TemplateFile : string with get
function get TemplateFile () : String

Property Value

Type: String
A String that contains the path and file name of the text template that is being processed.

Examples

The following code example shows a possible implementation for a custom host. This code example is part of a larger example. For the complete example, see Walkthrough: Creating a Custom Text Template Host.

string candidate = Path.Combine(Path.GetDirectoryName(this.TemplateFile), fileName);
if (File.Exists(candidate))
{
       return candidate;
}
Dim candidate As String = Path.Combine(Path.GetDirectoryName(Me.TemplateFile), fileName)
If File.Exists(candidate) Then
       Return candidate
End If

.NET Framework Security

See Also

Reference

ITextTemplatingEngineHost Interface

Microsoft.VisualStudio.TextTemplating Namespace

Other Resources

Processing Text Templates by using a Custom Host

Walkthrough: Creating a Custom Text Template Host

Code Generation and T4 Text Templates