How to: Specify File Output Types in Text Templates

You can add an output directive to text templates. This output directive indicates the kind of file that you want the template to generate. For more information, see Directive Syntax (Domain-Specific Languages).

To specify the output file type in a text template file

  1. Add an output directive to the template.

    In the following example, a .vb output file is generated.

    <#@ output extension=".vb" #>
    

    Note

    You can specify any appropriate file name extension, for example, .vb, .txt, .htm. By default, if you do not use an output directive, the output file will have a .cs file name extension.

  2. Right-click the text template file, and then click Run Custom Tool to generate an output file that has the file name extension you specified.

See Also

Tasks

Walkthrough: Creating and Running Text Templates

Other Resources

Using Built-in Directives in Text Templates

Adding Code to Text Templates

Generating Artifacts By Using Text Templates

Change History

Date

History

Reason

July 2008

Rewrote and refactored project.

Content bug fix.