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 (in Microsoft.VisualStudio.TextTemplating.dll)

Syntax

'宣言
ReadOnly Property TemplateFile As String
'使用
Dim instance As ITextTemplatingEngineHost
Dim value As String

value = instance.TemplateFile
string TemplateFile { get; }
property String^ TemplateFile {
    String^ get ();
}
function get TemplateFile () : String

Property Value

Type: System.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 that is provided for the ITextTemplatingEngineHost interface.

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

Permissions

See Also

Concepts

About Text Template Hosts

Walkthrough: Creating a Custom Text Template Host

Generating Artifacts Using Text Templates

Reference

ITextTemplatingEngineHost Interface

ITextTemplatingEngineHost Members

Microsoft.VisualStudio.TextTemplating Namespace