Code Generation Using Templates in Visual Studio 2008 and Higher

September 30, 2009 11:58 by Alec Bryte

If you've ever worked with CodeSmith or any other code generation toolkits, now you can enjoy the same functionality out of the box with Visual Studio 2008 or higher. The code name for it is T4, which stands for Text Template Transformation Toolkit.

The functionality is there but has been poorly documented in 2008 and the UI support is somewhat underdeveloped. This however has been fixed in Visual Studio 2010.

For more information, see Oleg Sych's blog entries on the topic.
http://www.olegsych.com/tag/code-generation/

In addition, there are some videos for it in Kevin Dietz's blog.
http://www.kevindietz.com/2009/03/27/UsingVisualStudio2008T4CodeGenerator.aspx

Finally, Scott Hanselman's blog entry
http://www.hanselman.com/blog/T4TextTemplateTransformationToolkitCodeGenerationBestKeptVisualStudioSecret.aspx