Reputation: 906
I would like to automatically execute one of the .tt files when my project is built, but not the others. Is it possible to set the TransformOnBuild property on specific .tt files instead of project wide? Or another method to accomplish this?
Upvotes: 2
Views: 1409
Reputation: 906
I have decided to add a custom pre build step to generate the .tt files needed:
<Exec Command=""%PROGRAMFILES(x86)%\Common Files\microsoft shared\TextTemplating\10.0\TextTransform.exe" template.tt -out template.cs" />
This method also allowed me to easily pass parameters (defined in the project file) to the template with -a; another problem I was facing.
Upvotes: 6
Reputation: 528
Answering as another method to accomplish this.
The first link includes this example, but it describes the use of preprocessed class: http://blogs.clariusconsulting.net/pga/vs10-beta-1-t4-preprocessing-part-2/
Upvotes: 0