In this post we will look into the properties determining the structure of the template from our last blog post. If you haven’t read that post you can check it out “Create Your Own T4 Item Template with “RadControls for ASP.NET AJAX VS Extensions” - Part 1”!
The most important file to examine is “TemplateInfo.xml”.
This is the actual template and contains the declaration of the template. The “TemplateInfo.xml” file can be divided in two major parts, the “Wizard” and the “UnfoldFiles”. The “Wizard” - node contains a number of general properties for the wizard, such as its Pages, Input and Output arguments, a Title, and so on… You can adjust every single one of these properties to your own preference.
The other part, the information included in the “UnfoldFiles” -node, defines what the template consists of.
The “UnfoldFiles” -node can be used to add items to your projects. These items can be classes, pages, user controls, assemblies, images, … and so on.
Here is a list of the nodes and their purpose:
Element | Child Elements | Parent Elements | Attributes |
TemplateInfo - This is the top-level container element for every TemplateInfo.xml file. | Name | -- | -- |
Name - Specifies the name of the template as it appears in the wizard. | -- | TemplateInfo | -- |
Image - Specifies the path and the filename of the image file that serves as the icon, which appears in the wizard. | -- | TemplateInfo | -- |
Description - Specifies the description of the template. | -- | TemplateInfo | -- |
Wizard - Contains the registration elements for customizing the template wizard. | Pages | TemplateInfo | ItemName - The base name of the item. |
Page - Represents a basic step that is displayed in the Wizard | Title Description Fields | Pages | -- |
Title - Specifies the title of the page. | -- |
| -- |
Description - Specifies the description of the page. | -- | Page | -- |
Field - Contains the controls that appear on each page. | Output Arguments | Fields | Type - The type of the control. Could be one of the following: CheckBox, DateTimePicker, MaskedEditBox, RadioButtonList, SpinEditor, TextBox, etc. |
UnfoldFiles - Specifies the contents of the template. | File | TemplateInfo | -- |
File - Specifies a T4 or Resource file that is included in the template. | Arguments | UnfoldFiles | SourcePath - The file to transform TargetPathVB - Specifies the name of the item that is created from the template. |
Plamen Peshev | The Telerik VSXTeam