Transforming T4 Templates On Build
Date: Monday, January 28, 2013 11:12 AM
Posted by: Nico Ploner
Category: T4
T4 templates provide essential parts of your source code. So how can you be sure that the generated code is always up to date? Can you guarantee that all templates have been transformed before debugging or even deploying your application?
Use the OnBuild Feature of tangible T4 Editor
In the Pro Version our T4 Editor provides the functionality of transforming selected templates when building a Visual Studio Solution. This means: every time you hit F5, debug or deploy your project all selected templates are transformed and the output data is always up to date!
To mark a template in your Solution for transformation on build, set the “Transform on Build” Property in the Property Grid to “True”.
Full Feature Support
When using a Command Line Tool at the Pre-Build Event of Visual Studio you cannot transform Templates that are host specific, access the Visual Studio Automation Interface or use variables like $SolutionDir.
The “Transform on Build” capability of the tangible T4 Editor is integrated into Visual Studio so there is no restriction to what Features can be used in the templates that are to be transformed.
Pro Feature Only
The “Transform on Build” Feature is only available in the Pro Version. You can purchase the Pro Version here.