A T4 template is a code-generation language that has been around since VS2005. You should be aware of them, as they are used in areas such as Entity Framework and MVC and can be useful for your own development. To see T4 templates in action, create a file with the extension .tt, add some text content, save the file, and note how Visual Studio will generate a code file from the template. You can apply complex logic using T4 templating language to change the output that is generated depending on various conditions. T4 templates in VS2010 are compiled when they are saved (preprocessed).

This means that they are another type that can be instantiated. Scott Hanselman has some great and information on this area so please refer to the following article:

www.hanselman.com/blog/T4TextTemplateTransformationToolkitCodeGenerationBestKeptVisualStudioSecret.aspx.

T4 templates don’t have Intellisense so your best bet is to download the Tangible T4 plugin:

http://visualstudiogallery.msdn.microsoft.com/en-us/60297607-5fd4-4da4-97e1-3715e90c1a23.

For more see:
http://code.msdn.microsoft.com/DslTools/Wiki/View.aspx?title=What%27s%20new

http://karlshifflett.wordpress.com/2009/10/30/t4-preprocessed-text-templates-in-visualstudio-2010/


Source of Information : Apress Introducing dot NET 4.0 with Visual Studio 2010

0 comments


Subscribe to Developer Techno ?
Enter your email address:

Delivered by FeedBurner