There is a "hidden" code generation feature in Visual Studio 2008 called Text Templating Transformation Toolkit or T4. It was added to VS2008 to help support Microsoft's Software Factory and DSL strategies.
The Basics:
Your add a .tt file to your project. You use VB.NET or C# to write code that generates any text output - .cs, .vb, .xml, .sql, .html, .xsd, .js, etc...
The templating syntax is similar enough to JSP or ASP.NET. This is an excellent way to bring code generation directly into your IDE.