Search code examples
c#visual-studio-codecode-generationt4texttemplate

Executing a T4 text template in Visual Studio Code


I created a T4 text template (.tt) file in Visual Studio Code, but unlike Visual Studio 2017 (or 2015 ,...) it won't generate the output file after saving the .tt file. How can I generate the output in Visual Studio Code?


Solution

  • This solution is not exactly what you asked, but it may be useful in many scenarios (on Windows OS only).

    You can create a task in Visual Studio Code and run C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\TextTransform.exe. If you don't have Visual Studio you can copy this file to your project folder and execute it from that location.

    Any extension that can run a .exe file can do the job.