tags:

views:

257

answers:

1

Using T4 I want to generate some code based on examining what files are in a directory relative to the template file being executed.

Is there a way in c# to identify what the path of the current template file is?

+2  A: 

You need to set the hostspecific property of the template directive to True. This will make T4 generate a special property called Host, which gives you access to ResolvePath method and TemplateFile property. You can find details here: http://www.olegsych.com/2008/02/t4-template-directive/

Oleg Sych
Thanks for the info, sorry it took me so long to accept.
Andrew Theken