T4 template parser is a text transformation utility created by Microsoft and has been available in Visual Studio since 2008. We have extensively used this utility to generate most of the repeatable code like POCO, Data Access Object, Stub Services, Stub Unit Tests etc.
Though for VS Code, we had been missing this feature to easily generate the code. Our team members Samir Bhatt and Shreenil Patel developed a VS Code Extension to process files with ".TT" extension to generate code using T4 template definition.
You can download the Extension from here:
Or you can simply search the extension in VS Code by searching for "T4" and "TT-Processor" should come up. Currently the extension works with VS Code version 1.24.x. And you will need to update the user-settings to set correct path for the processor. If you have .Net Framework installed then the the texttransform.exe is available either in 12.0 or 14.0 folder. Please verify to make sure the extension runs correctly.
"TTPath": "C:\\\"Program Files (x86)\"\\\"Common Files\"\\\"microsoft shared\"\\TextTemplating\\12.0\\TextTransform.exe"
Once the extension is downloaded, create a dummy file with extension ".tt" and save it. While saving the file, the output file will be generated.
We are exploring the possibilities to generating code for Angular projects using TT files, so stay tuned for more updates in coming weeks.