Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Design-time T4 templates in ASP.NET 5 (VS 2015)

I can't seem to find a way to make T4 templates in VS 2015 RTM, in an ASP.NET 5 (vNext) project.

I even installed the T4 toolbox for Visual Studio 2015 extension, but the tt templates are not transformed.

The property Custom Tool doesn't appear in the tt file properties, neither can't I find the 'Run Custom Tool' command.

Update

The reason I want the T4 templates, is the introduction of the config.json file, and the pluggable configuration system, which is an awesome thing, but with the price of not having the setting properties strongly-typed.
I've read this article that explains how to achive this, but there is still no generation. Since I have a pretty complex configuration structure, I thought about making a T4 template that will generate an AppSettings file. Any ideas on that are obviously welcome too.

like image 200
Shimmy Weitzhandler Avatar asked Dec 19 '22 01:12

Shimmy Weitzhandler


1 Answers

The ASP.Net 5 (vnext) project is a completely new animal and technically still in beta, its not scheduled for RC til November 2015. Also it's attempting to be completely cross platform so initially the team favored using razor templates instead of T4 for scaffolding. They had no plans to support T4 (or any single file generators) at all until an out cry from the community made them change their mind. According to that thread they will support it but have given no dates. They do seem to have made progress, back in January when I was testing my T4 extension I had issues with the project file(now in json format) not supporting custom properties but as of the release on 7/20/2015 it seems to work now. The engine for running T4 inside of visual studio 2015 is still there so you can use it if you like from other project types. You can create a console app and have it store the T4 files but generate them in the vnext project. If you want a cleaner solution you can also try out my extension T4 Awesome, it gives you a way to organize and call your templates via right click menus.

like image 147
Frank Avatar answered Jan 10 '23 19:01

Frank