How to transform T4 templates on build without installing a Visual Studio SDK
The MS recommended way is to just use the Microsoft.TextTemplating.targets which come with the Visual Studio Visualization and Modeling SDK. It makes me slightly nervous that it requires a little known SDK that is hosted on http://archive.msdn.microsoft.com/vsvmsdk rather than something more “official” like the MSDN Download Center, where the proper VS SDK lives. It also turns out to be absolutely unnecessary, since all you need is already installed with your base Visual Studio setup.
Visual Studio installs the
TextTransform.exe
utility, which can use used to transform a template
automatically. Ideally, you shouldn’t have to do anything
different than you do today when using text templates, and
the automatic build-time transform should “just happen”. One
way to achieve this is by grabbing all the files that have
one of the T4 custom tools assigned (they are always
assigned them when you create a new text template in
VS):...