Visual Studio’s Built-In Code Generation Tool

As I was listening to my buddy Clark Sell’s podcast on www.DeveloperSmackdown.com, 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: https://visualstudiomagazine.com/articles/2009/05/01/visual-studios-t4-code-generation.aspx

Generating Artifacts with Templates: https://msdn.microsoft.com/en-us/library/bb126445.aspx

Jose Escrich Blog Post on T4 Editor: https://weblogs.asp.net/jescrich/archive/2007/06/07/new-t4-template-visual-studio-editor.aspx

Clarius Consulting’s Visual T4 Blog: https://www.visualt4.com/ 

 

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