views:

126

answers:

3

I am using T4 for generation of some DTO classes + mappers.

I am splitting the files in a number of re-usable bits (some of which containing common methods, some others common procedures) and including them into the T4 templates that will produce my output - which is all good.

My problem is that the re-usable .tt files will try and produce their own output and fail (because they are coupled to some other .tt files) every time I make a change to them, which plain sucks.

I am pretty sure I saw somewhere some directive to specify a given file shouldn't try and produce any output, but I can't seem to track it back.

Any help appreciated!

+3  A: 

In the properties (select file and press F4) of the T4 files for which you'd like to suppress output, clear the 'Custom Tool' entry.

AdamRalph
this sounds exactly what I need - is there any way of doing this from the markup?
JohnIdol
Its in the markup for the project - ie the .xxproj file.
Preet Sangha
@JohnIdol - I don't believe there is a way to suppress the output in the mark up of the T4 file itself. As Preet says, the setting is controlled by the extistence of a <Generator>TextTemplatingFileGenerator</Generator> element in the project file so you can delete that as an alternative to clearing the property via the VS GUI.
AdamRalph
A: 

rename them to .ttinclude and see how that goes for ya....

Sky Sanders
+1  A: 

You can specify invalid extension to suppress the output of your template, for example:

<#@ output extension="\n" #>
Stanislav Kniazev
nice trick - thanks!
JohnIdol