2.2. Text Template Transformation Toolkit Files

A Text Template Transformation Toolkit (T4) template is a code-generation language that has been around since VS2005. You should be aware of T4 templates, as they are used in areas such as Entity Framework and ASP.NET 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. ...

Get Introducing .NET 4.0: with Visual Studio 2010 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.