Share via


Developing T4 Templates

Retired Content

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies.
This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

In some cases, an action will be used to generate text from a T4 text template. For example, if an action is used to generate a class, that class may contain text that is defined within a T4 template. The T4 template consists of a combination of text and scriptlets. Text is inserted into the template output stream as-is. Scriptlets are expressions in Visual Basic or Visual C# that, when executed, return a string that is directly inserted into the output stream of the template. Templates are expanded by the T4 engine included with the Guidance Automation Toolkit. The engine is also included with the Domain Specific Language (DSL) SDK.

The toolkit includes a reusable (library) action, implemented by the TextTemplateAction.cs class, which you can use to run the T4 engine on an input template and receive the result string. For more information about the T4 engine, see The T4 Templating Engine.

See also

Syntax of T4 Templates