T4

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.
 * Information on MSDN
 * Wikipedia

Editors
In standard Visual Studio there is no native support for editing T4 templates. Venders have created tools that support intellisense, color coding and debugging.
 * 1) Tangible Engineering T4 Editor
 * 2) Dev Art T4 Editor
 * 3) Clarius Consulting Visual T4

Code

 * 1) T4 Toolbox
 * 2) T4Utility Belt