Visual Studio’s Built-In Code Generation Tool

As I was listening to my buddy Clark Sell’s podcast on, I heard them talking about a tool that I kept hearing about but never personally used, and honestly didn’t know too much about.  I digress...


Ever sit there at your desk, coffee or Dew in hand thinking, “geez, why can’t some of this basic code be automatically generated by the computer using my software factories in the managed language of my choice?”.  Uuhhh, well, you can, and it does!  The Patterns and Practices team and the DSL team have been using it for some time.  The Text Templating Transformation Toolkit (T4) is actually already on your machine if you're using Visual Studio 2008.  Seriously, check it out!  You can also get it by downloading the DSL Toolkit if you're using Visual Studio 2005.

Some of the features of the T4 Editor:
- Available for Visual Studio 2005 and 2008 (Orcas B2)
- Colorization of directives, text blocks and code.
- Intellisense on directives and attribute values.
- Support for multiples host (GAX, DSLTools and Clarius)
- Preview transformation and properties reflection


Here are a few articles to help get you up to speed:

Visual Studio T4 Code Generator:

Generating Artifacts with Templates:

Jose Escrich Blog Post on T4 Editor:

Clarius Consulting’s Visual T4 Blog: 


Technorati Tags: Visual Studio 2008,T4,P&P,DSL Toolkit