This documentation is archived and is not being maintained.

How to: Specify File Output Types in Text Templates 

Visual Studio 2005

You can add an output directive to text templates that indicates the type 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. In Solution Explorer, right-click the text template file that you want to edit, and then click Open.

    The template opens in the editor.

  2. Add an output directive to the template.

    In the following example, a .vb output file will be generated:

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

    You can specify any appropriate file type extension (for example, .vb, .txt, .htm, and so on). If no output directive is used, the output file will have a .cs extension by default.

  3. Right-click the text template file, and click Run Custom Tool to generate the output file with the extension that you specified.


    To debug text templates, you must set the debug parameter of the template directive. For more information, see How to: Debug Text Templates.


For more information, see Security of Text Templates.

See Also