Jump to content
 







Main menu
   


Navigation  



Main page
Contents
Current events
Random article
About Wikipedia
Contact us
Donate
 




Contribute  



Help
Learn to edit
Community portal
Recent changes
Upload file
 








Search  

































Create account

Log in
 









Create account
 Log in
 




Pages for logged out editors learn more  



Contributions
Talk
 



















Contents

   



(Top)
 


1 Overview  





2 Controls  





3 History  





4 See also  





5 References  





6 External links  














Text Template Transformation Toolkit






Français

Українська
 

Edit links
 









Article
Talk
 

















Read
Edit
View history
 








Tools
   


Actions  



Read
Edit
View history
 




General  



What links here
Related changes
Upload file
Special pages
Permanent link
Page information
Cite this page
Get shortened URL
Download QR code
Wikidata item
 




Print/export  



Download as PDF
Printable version
 
















Appearance
   

 






From Wikipedia, the free encyclopedia
 


Text Template Transformation Toolkit (T4)
Original author(s)Novell, Xamarin, Microsoft
Initial release2005; 19 years ago (2005)
Stable release

v2.0.5 / June 13, 2019; 5 years ago (2019-06-13)[1]

Repositorygithub.com/mono/t4
Written inC#
Operating systemLinux, Windows
Platform.NET Framework,
.NET Core,
Mono
TypeSoftware framework
LicenseMIT License
WebsiteCode Generation and T4 Text Templates

Text Template Transformation Toolkit (usually referred to as "T4") is a free and open-source template-based text generation framework. T4 source files are usually denoted by the file extension ".tt".

Overview[edit]

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, HTMLorXAML.

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.[2] By using the Text Transformation class, T4 can also be run entirely from within a .NET application, eliminating 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.[3] It is also used outside of Microsoft in projects such as SubSonic.[4]

T4 templating is supported in Visual Studio, MonoDevelop and JetBrains Rider.[5]

Controls[edit]

There are four types of controls handled by the T4 template transformation engine.

Name Syntax Description
Directives <#@ ... #> Instructions for the transformation engine
Standard control blocks <# ... #> Code to be executed (e.g. loops)
Expression control blocks <#= ... #> Expressions evaluated and converted to a string
Class feature control blocks <#+ ... #> Class and function definitions

History[edit]

See also[edit]

References[edit]

  1. ^ "Tags · mono/t4 · GitHub". GitHub T4 repository. Retrieved 2020-01-06.
  • ^ Web Templates (2013), Website templates, Website Templates South Africa, ISBN 978-1-4251-3374-0, retrieved 19 November 2013
  • ^ "Fun with T4 templates and Dynamic Data - Angle Bracket Percent - Site Home - MSDN Blogs". Blogs.msdn.com. 2008-11-26. Retrieved 2012-05-17.
  • ^ "SubSonic v3's T4 Templates « Daily Cycle". Gcapnias.wordpress.com. 2009-01-12. Retrieved 2012-05-17.
  • ^ "Rider: The Cross-Platform .NET IDE from JetBrains".
  • ^ "What's new in T4 in Visual Studio 2010 - [Profoundly Esoteric Image] - Site Home - MSDN Blogs". Blogs.msdn.com. 2010-04-15. Retrieved 2012-05-17.
  • ^ "Code Generation and T4 Text Templates - Visual Studio (Windows)".
  • ^ "Mono.TextTemplating". GitHub. 22 October 2021.
  • ^ "ForTea". GitHub. 20 October 2021.
  • External links[edit]


    Retrieved from "https://en.wikipedia.org/w/index.php?title=Text_Template_Transformation_Toolkit&oldid=1161136759"

    Categories: 
    .NET
    Free and open-source software
    Microsoft free software
    Microsoft Visual Studio
    Software that uses Mono (software)
    Software using the MIT license
    Template engines
    2005 software
    2008 software
    2010 software
    Hidden categories: 
    Articles with short description
    Short description matches Wikidata
     



    This page was last edited on 20 June 2023, at 21:51 (UTC).

    Text is available under the Creative Commons Attribution-ShareAlike License 4.0; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.



    Privacy policy

    About Wikipedia

    Disclaimers

    Contact Wikipedia

    Code of Conduct

    Developers

    Statistics

    Cookie statement

    Mobile view



    Wikimedia Foundation
    Powered by MediaWiki