T5 is an open-source implementation of the T4 text templating engine for .NET Core based on and derived from Mono.TextTemplating.
The TextTransform tool can be installed into a .NET Core 2.0 project by adding
a <DotNetCliToolReference>
node to the project file, as shown below:
<ItemGroup>
<DotNetCliToolReference Include="T5.TextTransform.Tool"
Version="1.1.0-*" />
</ItemGroup>
Set the Version
attribute value to the desired version of the tool.
The reference will cause the tool to be installed whenever dotnet restore
is run next. It can then be used as follows:
dotnet tt TEMPLATE
Replace TEMPLATE
with the path to your T4 template.
For full help on usage, run:
dotnet tt --help
When you run dotnet tt
, make sure that you do so from the project's
directory set as your shell's current directory otherwise dotnet
will
complain with an error message along the lines of:
No executable found matching command "dotnet-tt"
Make sure that the .NET SDK Core 2.0 is installed.
To build the project, run build.cmd
on Windows or build.sh
on macOS or a
supported Linux distribution.
To run the unit tests, run test.cmd
on Windows or test.sh
on macOS or a
supported Linux distribution. The test script builds the project before
running the unit tests.
To build NuGet packages for distribution, run pack.cmd
on Windows or
pack.sh
on macOS or a supported Linux distribution. The packaging script
builds the project but does not run unit tests. The script accepts a single
optional argument that is used as the version suffix of the packages, e.g.
beta1
.