A friend of me had a little rant while developing an Angular app on a .NET Core backend. Whenever you had to run the npm run E2E command or any other npm or ng command, you had to right click on the folder node in solution explorer, open with file explorere, open cmd and maybe navigate to the right directory (cd ..).
This made me think of another fun little project to work on. Figuring out a way to open the terminal directly in the directory you want, straight from Visual Studio’s solution explorer. Just right click a folder, click ‘Open Terminal’ and there it is.
Several developers complain about the lack of a proper T4 editor experience, as everything is just shown as plain text. See my other T4 tutorials to see the regular T4 text files in the header image.
I created a Visual Studio extension called T4Editor that adds colors to different blocks in you code. You can easily spot the difference between output code, control blocks and class feature blocks. This increases coding productivity and readability of your T4 templates.
In the future, C# code inside these blocks will also be highlighted with the propper C# syntax colors, I’m still working on that.
Update: Now you can set custom colors! Navigate to Extensions – T4Editor – Adjust Colors and pick whatever colors you want.
Update 2: There is now code completion/minor custom intellisense for codeblocks!
Update 4: I have implemented brace matching and improved RegEx. Typing ‘var string = “#>” for example, will not act as a closing tag.
Click here to see the code. Feel free to give feedback or even contribute!
Visual Studio 2019 released earlier this week. When I build my experimental TexTran project, I noticed none of the T4 Templates were executed. I used AutoT4 in the past (a VS2012 extension) but this package is not available in the latest 2019 version.
I added an extension to the Visual Studio Marketplace called TT4Executer. When installed, in executes all T4 Templates every time you build or rebuild your solution. This is enabled by default, and an be toggled in the Extensions > T4Executer > Enable/Disable menu.
It’s a pretty simple package, that adds an event to the OnBuildBegin event that fetches all .tt files in all active projects and executes them in before building your projects.
This is my first VSIX project, and it’s open for contributions and improvements, the source code can be found here.
Update: I added an options dialog where you can select which templates to ignore. This is found in the Extensions > T4Executer > Ignore Template menu.
Update 2: I a new option where you can specifiy to execute templates before or after build or ignore them. This can be configured via Extensions > T4Executer > Configure.