Over the last few posts, I’ve talked about the exciting improvements we’ve made to T4 Text Templating in Service Pack 1 for Visual Studio 2010.
Here’s a quick roundup:
Firstly, T4 no longer locks referenced assemblies in memory, meaning it’s much easier to use reflection in T4 templates and to use compiled helper libraries.
Then I posted a series explaining how to use template inheritance for greater template reuse and easier template customization
In Part I, I started by setting the scene of why you’d want inheritance and setting up some metadata to drive an example template from.
In Part II, I put together a T4 preprocessed template that’s designed to be reusable and customizable with natural override points.
In Part III, I showed how to exploit the customization points to produce code that’s specific to a new project reusing a base template.
In Part IV, I wrapped up by showing how to use a helper class to apply the same technique used in preprocessed templates with regular T4 templates.
I hope you’re as excited as we are about these improvements – we really think they make working with T4 a smoother experience.