T4 Template Items
I've just finished working on a new How Do I video for Visual Studio Extensibility on the topic of T4 Code Generation [Update: the video is now live at How Do I: Create And Use T4 Templates?]. T4, or Text Template Transformation Toolkit, is the free code generation engine from Microsoft that underpins their Domain Specific Languages and Software Factories toolkits. T4 is usually used only to generate code from the models in your DSL, but it's a pretty rich code generation engine in it's own right. I've played a lot over the years with CodeSmith and MyGeneration, so I've been meaning to play with T4 for a while. What's nice about the new version is that it is now built into Visual Studio 2008 - no need for the SDK to get it any more.
If you're interested in finding out more about how T4 works, and to get some great samples, check out Oleg Sych's blog.
One thing I noticed when working with T4 though, is that while the ".tt" file extension works in Visual Studio, there is no item template when you Add .. New Item to your project. I've put 2 Item Templates together to overcome this - one for a simple T4 template and one for an SMO Database-driven template (thinking of replacing the code generator for LINQ To SQL?). You can download the simple T4 C# item template here and the T4 C# Database item template here. To use the templates, simply drop the files into [My Documents]\Visual Studio 2008\Templates\ItemTemplates\
By the way, if you're working with and creating T4 templates, make sure you check out the great free T4 Editor from Clarius Consulting.