Text Template Transformation Toolkit
Encyclopedia
Microsoft
's Text Template Transformation Toolkit (usually referred to as "T4") is a template based text generation framework included with Visual Studio. T4 source files are usually denoted by the file extension ".tt".
T4 is used by developers as part of an application or tool framework to automate the creation of text files with a variety of parameters. These text files can ultimately be any text format, such as code (for example C#), XML, HTML or XAML.
T4 uses a custom template format which can contain .NET code and string literals in it, this is parsed by the T4 command line tool into .NET code, compiled and executed. The output of the executed code is the text file generated by the template. T4 can also be completely run within the .NET applications via the use of the TextTransformation class which eliminates the need for the end user to have Visual Studio installed.
T4 is used within Microsoft in ASP.NET MVC for the creation of the views and controllers, ADO.NET Entity Framework
for entity generation, and ASP.NET Dynamic Data
. It is also used outside of Microsoft in projects such as SubSonic
Microsoft
Microsoft Corporation is an American public multinational corporation headquartered in Redmond, Washington, USA that develops, manufactures, licenses, and supports a wide range of products and services predominantly related to computing through its various product divisions...
's Text Template Transformation Toolkit (usually referred to as "T4") is a template based text generation framework included with Visual Studio. T4 source files are usually denoted by the file extension ".tt".
T4 is used by developers as part of an application or tool framework to automate the creation of text files with a variety of parameters. These text files can ultimately be any text format, such as code (for example C#), XML, HTML or XAML.
T4 uses a custom template format which can contain .NET code and string literals in it, this is parsed by the T4 command line tool into .NET code, compiled and executed. The output of the executed code is the text file generated by the template. T4 can also be completely run within the .NET applications via the use of the TextTransformation class which eliminates the need for the end user to have Visual Studio installed.
T4 is used within Microsoft in ASP.NET MVC for the creation of the views and controllers, ADO.NET Entity Framework
ADO.NET Entity Framework
ADO.NET Entity Framework is an object-relational mapping framework for the .NET Framework.-Overview:ADO.NET Entity Framework abstracts the relational schema of the data that is stored in a database and presents its conceptual schema to the application...
for entity generation, and ASP.NET Dynamic Data
ASP.NET Dynamic Data
ASP.NET Dynamic Data is a Ruby on Rails-inspired web application scaffolding framework from Microsoft, shipped as an extension to ASP.NET, that can be used to build data driven web applications. It exposes tables in a database by encoding it in the URI of the ASP.NET web service, and the data in...
. It is also used outside of Microsoft in projects such as SubSonic
Subsonic (software)
SubSonic is an open source object-relational mapper for Microsoft .NET Framework maintained by Rob Conery. The current version is , released in July 2009.- Supported databases :SubSonic 3.0 supports databases that can be used through System.Data.Common:...
Criticism
Microsoft has often been criticized for the lack of tooling support for T4 within the Visual Studio IDE, and relies on third parties namely Tangible Engineering and Clarius Consulting.History
- 2005: Microsoft released the first version of T4 as an out of band release for Visual Studio 2005
- 2008: Microsoft includes it in the box with Visual Studio 2008
- 2010: Microsoft includes it in the box with Visual Studio 2010 which included significant new features to improve performance, usability for both template authors and tool builders and better integration into Visual Studios DSL tools.