Code Generation and T4 Text Templates
Updated: March 2011
In Visual Studio, a T4 text template is a mixture of text blocks and control logic that can generate a text file. The control logic is written as fragments of program code in Visual C# or Visual Basic. The generated file can be text of any kind, such as a Web page, or a resource file, or program source code in any language.
There are two kinds of T4 text templates:
Note |
|---|
The term model is sometimes used to describe data read by one or more templates. The model can be in any format, in any kind of file or database. It does not have to be a UML model or a Domain-Specific Language model. 'Model' just indicates that the data can be defined in terms of the business concepts, rather than resembling the code. |
The text template transformation feature is named T4.
The T4 Developer Center collects samples, tips, and frequently asked questions about T4.
T4 Samples : http://t4talk.codeplex.com/
T4 tools on CodePlex: http://www.codeplex.com/site/search?query=T4%20Template&sortBy=Relevance&licenses=|&ac=8
CodePlex is Microsoft's open source project hosting web site. You can use CodePlex to create new projects to share with the world, join others who have already started their own projects, or use the applications on this site and provide feedback.
- 9/24/2010
- Esther Fan
- 5/8/2012
- Olaf Meyer
The free OMS.Ice - T4 Text Template Generator is hosted on Codeplex: http://omsice.codeplex.com/
- 5/8/2012
- Olaf Meyer
- 5/8/2012
- Olaf Meyer
http://www.olegsych.com/2007/12/text-template-transformation-toolkit/
A free T4 Editor that adds syntax highlighting and IntelliSense to Visual Studio for T4 Text Templates is here:
http://t4-editor.tangible-engineering.com
A tutorial on how to generate from an UML Diagram with Text Templates can be found here:
http://www.olegsych.com/2007/12/text-template-transformation-toolkit/
- 4/15/2010
- Tim F. Fischer
Note