This documentation is archived and is not being maintained.

ITextTemplatingEngineHost.SetFileExtension Method

Tells the host the file extension expected for the generated text output.

Namespace: Microsoft.VisualStudio.TextTemplating
Assembly: Microsoft.VisualStudio.TextTemplating (in microsoft.visualstudio.texttemplating.dll)

void SetFileExtension (
	string extension
void SetFileExtension (
	String extension
function SetFileExtension (
	extension : String



The file extension for the generated text output file.

If the user has specified the optional output parameter of the template directive in a text template, the engine calls this method. For more information, see Directive Syntax (Domain-Specific Languages).

The following code example shows a possible implementation for a custom host. This code example is part of a larger example provided for the ITextTemplatingEngineHost interface.

//the host can provide a default by setting the value of the field here
private string fileExtensionValue = ".txt";
public string FileExtension
    get { return fileExtensionValue; }

public void SetFileExtension(string extension)
    //the parameter extension has a '.' in front of it already
    fileExtensionValue = extension;