Wednesday, April 16, 2008

Interested in template based code generation? Own Visual Studio 2008? Then guess what? You already have one... Say hello to the Text Template Transformation Toolkit (T4)

Oleg Sych - Text Template Transformation Toolkit

"Text Template Transformation Toolkit (T4) is a template-based code generation engine. It is included with Visual Studio 2008 and available as a download for Visual Studio 2005 in DSL and GAT toolkits. You can use T4 templates to generate Visual Basic, C#, T-SQL, XML or any other text files.

Syntax

T4 templates have ASP.NET-like syntax and consist of processing directives, text blocks and code blocks.

<#@ template language="C#" #>
Hello
<# Write("World!") #>

Processing directives provide template compilation and processing options. In the example above, <#@ template #> directive specifies that code blocks of this template are written in C#.

..."

madhavrao… - T4 - How to

"List of How-to for Text Transformation Template Toolkit (T4)

..."

Clarius Consulting - T4 Editor (Beta)

"...

The T4 engine used to support transformations is currently distributed by the Visual Studio SDK and with the advent of Visual Studio 2008 (codenamed Orcas) the T4 bits will be come pre-installed "into the box" on all Visual Studio installations (Standard edition and better).

Unfortunately, the design-time experience when using T4 is not yet on a par compared with what you are used to expect from other tools integrated within Visual Studio.

The T4 Editor developed by Clarius Consulting is aimed at converting this missing experience into a first class one, fully integrated into the development environment, offering you support for colorization of the different T4 template parts, IntelliSense, and design-time preview of your templates.

Our T4 Editor is currently supported under both Visual Studio 2005 and Visual Studio 2008 products.

..."

I heard about this today in the recent DotNetRocks cast and seeing the ZarkBlog post reminded me to check it out...

This is pretty cool. It seem that we, VS2008 users, have a template based code generation feature included in the box (and VS2005 users can also get it as a separate download) Free, gratis, etc.

More stuff to play with... :)

(via DotNetRocks - It's the ALT.NET Show! & ZarkBlog - Text Template Transformation Toolkit (T4))

No comments: