How to trigger T4 template from PowerShell script How to trigger T4 template from PowerShell script powershell powershell

How to trigger T4 template from PowerShell script


It looks like you can just invoke their command line utility, so you could create a script that just takes the location of your .tt file.

param([string] $T4Template)& "C:\Program Files (x86)\Common Files\microsoft shared\TextTemplating\10.0\TextTransform.exe" $T4Template

Save above as ExecTextTransform.ps1 and then call with your paths.Example:

.\ExecTextTransform.ps1 c:\temp\example.tt

See here for an example of calling their command line utility.