How to: Add a Statement to Text Templates
You can use text templates to generate code, XML, reports, or other artifacts from models. You can useblocks to add Visual Basic or Visual C# code to your template. The code should be expressed using the language that is declared in the language parameter of the template directive.
To add a statement to a text template
In Solution Explorer, right-click the text template file that you want to edit, and then click Open.
The template opens in the editor.
In text templates, you delineate code statements using an opening "<#" tag and a closing "#>" tag. Add statement tags to your text template with code, as shown in the following example. In this example, the code loops through each ModelType in ClassModel.Types:
<# Dim type as ModelType For Each type in Me.ClassModel.Types #> // template blocks <# Next #>
For an example of how to create a fully coded and running text template, see
To debug text templates, you must set the debug parameter of the template directive. For more information, see.
For more information, see.