How to: Specify File Output Types in Text Templates

Updated: July 2008

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" #>
    
    NoteNote:

    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.

Date

History

Reason

July 2008

Rewrote and refactored project.

Content bug fix.

Community Additions

Show: