Content deleted Content added
ArmbrustBot (talk | contribs) m →References: re-categorisation per CFDS, replaced: Category:.NET framework → Category:.NET Framework using AWB |
m Bot: http → https |
||
(42 intermediate revisions by 25 users not shown) | |||
Line 1:
{{Short description|Open-source template-based text generation framework}}
[[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".▼
{{Infobox software
| name = Text Template Transformation Toolkit (T4)
| author = [[Novell]], [[Xamarin]], [[Microsoft]]
| developer =
| released = {{Start date and age|2005}}
| latest release version = v2.0.5
| latest release date = {{Start date and age|2019|06|13}}<ref>{{cite web|url=https://github.com/mono/t4/tags|title=Tags · mono/t4 · GitHub|website=GitHub T4 repository|language=en|access-date=2020-01-06}}</ref>
| repo = {{URL|https://github.com/mono/t4}}
| programming language = [[C Sharp (programming language)|C#]]
| operating system = [[Linux]], [[Microsoft Windows|Windows]]
| platform = [[.NET Framework]],<br />[[.NET Core]],<br />[[Mono (software)|Mono]]
| genre = [[Software framework]]
| license = [[MIT License]]
| website = {{URL|1=https://docs.microsoft.com/en-us/visualstudio/modeling/code-generation-and-t4-text-templates?view=vs-2019|2=Code Generation and T4 Text Templates}}
}}
▲
==Overview==
T4 is used by [[Developer (software)|developers]] as part of an application or tool [[Framework (computer science)|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 Sharp (programming language)|C#]]), [[XML template engine|XML]], [[HTML]] or [[XAML Browser Applications|XAML]].
T4 uses a custom template format which can contain .NET code and [[string literal]]s 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.<ref name="Templatesza">{{citation|author=Web Templates|title=Website templates|url=http://www.websitetemplates.org.za/website-templates-type/|
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]].<ref>{{cite web|url=http://blogs.msdn.com/b/davidebb/archive/2008/11/26/fun-with-t4-templates-and-dynamic-data.aspx |title=Fun with T4 templates and Dynamic Data - Angle Bracket Percent - Site Home - MSDN Blogs |publisher=Blogs.msdn.com |date=2008-11-26 |
T4 templating is
==
There are four types of controls handled by the T4 template transformation engine.
{| class="wikitable" style="font-size: 0.9em; margin-left: 1em"
|-
! Name
! Syntax
! Description
|-
| Directives
| <code><#@ ... #></code>
| Instructions for the transformation engine
|-
| Standard control blocks
| <code><# ... #></code>
| Code to be executed (e.g. loops)
|-
| Expression control blocks
| <code><#= ... #></code>
| Expressions evaluated and converted to a string
|-
| Class feature control blocks
| <code><#+ ... #></code>
| Class and function definitions
|}
==History==
* 2005: Microsoft released the first version of T4 as an out
* 2008: Microsoft includes it
* 2010: Microsoft includes it
* 2015: Visual Studio 2015 Update 2 can use C# version 6.0 features<ref>{{Cite web|url=https://docs.microsoft.com/en-us/visualstudio/modeling/code-generation-and-t4-text-templates|title = Code Generation and T4 Text Templates - Visual Studio (Windows)| date=12 January 2024 }}</ref>
* 2017: Open source version of engine released which supports [[.NET Core]]<ref>{{Cite web|url=https://github.com/mono/t4|title = Mono.TextTemplating| website=[[GitHub]] |date = 22 October 2021}}</ref>
* 2019: JetBrains adds support for T4 in Rider<ref>{{Cite web|url=https://github.com/jetbrains/fortea|title = ForTea| website=[[GitHub]] |date = 20 October 2021}}</ref>
==See also==
{{Portal|Free and open-source software}}
* [[Comparison of code generation tools]]
* [[m4 (computer language)]]
* [[Smarty (template engine)|Smarty]]
==References==
{{Reflist|3}}
==External links==
* [https://github.com/mono/t4 GitHub - mono/t4: T4 text templating engine]
{{Microsoft development tools}}
{{Microsoft APIs}}
{{Microsoft FOSS}}
{{Microsoft}}
{{.NET Framework}}
Line 32 ⟶ 80:
{{DEFAULTSORT:Visual Studio}}
<!-- Please do not add [[Category:Microsoft development tools]] or [[Category:Integrated development environments]]. Category:Microsoft Visual Studio is already a sub-category of those categories. -->
[[Category:Free and open-source software]]
[[Category:Microsoft free software]]
[[Category:Microsoft Visual Studio]]
[[Category:Software that uses Mono (software)]]
[[Category:Software using the MIT license]]
[[Category:Template engines]]
▲[[Category:.NET Framework]]
[[Category:2005 software]]
[[Category:2008 software]]
|