The property directive is one of the most discussed features of T4. By Microsoft it is implemented in the GAX Host not in the standard Visual Studio Host. This means that when you run a template by saving it with the standard mechanism (DSLTools) in Visual Studio it will fail.
Although there are other good mechanism for making reusable templates users of GAX/GAT and Blueprints need to rely on this mechanism.
But how can can work with GAX templates and call them from standard Text Templates, then?
1. You need to install GAX from here.
2. You need to get the T4GAXRunner.ttinclude template
Luckily tangible published a TT-Include File that provides the necessary code. You find it in the in-product template gallery of tangible’s T4 Editor. You can read about the gallery here.
The Code to use T4GAXRunner looks like this. The anonymous object encapsulates the parameters and values you want to pass as members.
This would then call a typical GAX.tt file like this one.
Conclusion
You can run your GAX based files from a standard T4 files. Just download tangible’s T4 Editor and get the template from the gallery.
No comments:
Post a Comment