Freigeben über


How to: Split Text Templates Into Multiple Files

You can split text templates across several files for size or organizational reasons. Most commonly, you will split a text template into multiple files to allow a portion of a text template to be reused in other templates. The following procedure describes how to use the include directive to use multiple text template files within a single text template. For more information, see Directive Syntax (Domain-Specific Languages).

To add the include directive to a text template

  1. In Solution Explorer, right-click the text template file that will use the include directive, and then click Open.

    The template opens in the editor.

  2. Add the following directive to the template:

    <#@ include file ="MyTextTemplateFile2.ReportTemplate"#>
    
    Important noteImportant Note:

    Replace the file name MyTextTemplateFile2.ReportTemplate with the name of your file.

For a detailed example demonstrating splitting a text template into multiple files, see Walkthrough: Creating and Running Text Templates. In the walkthrough, the system removes functions defined in a text template from the template and places them in another file for organizational purposes.

Hinweis

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

Security

For more information, see Security of Text Templates.

See Also

Concepts

Using Built-in Directives in Text Templates

Adding Code to Text Templates

Generating Artifacts Using Text Templates

Walkthrough: Creating and Running Text Templates