What are T4 templates?


T4 (Text template transformation toolkit) is template based code generation engine. So you can go and write C# code in T4 templates ( .tt is the extension) files and those c# codes execute to generate the file as per the written C# logic.

For instance the below T4 c# code:-

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

Will generate the following C# output:-
Hello
World !