Transformer
Transformer

Reputation: 7439

T4 templates vs TT Templates vs Includes in visual studio

In visual studio there are 2 types of text transformation templates file extensions .T4 vs .TT

I would like to know their differences and which one I should use when I want extend to build Views Controllers and Models, when I read a schema off a DB

I also want to know if .includes can be reused in both.

Upvotes: 3

Views: 1715

Answers (1)

McGuireV10
McGuireV10

Reputation: 9946

There is no difference. Back around 2008 this feature was treated as if it were an add-in (even though it ended up being built into VS directly). Microsoft called it the "Text Template Transformation Toolkit," hence the .T4 extension. Common usage shortened that to "text templates" yielding the .TT extension and this appears to have become the standard extension.

Transformation files are just code, they can use any feature of the language you choose. For example, in C# templates I regularly reference .NET assemblies as follows:

<#@ import namespace="System.Text" #>

Upvotes: 7

Related Questions