Getting physical path of folder in project

Aug 10, 2010 at 6:06 PM

Hi experts,

what is the easiest way in a T4 template to get the physical path of a folder in my VS solution?
I need to read files from that folder in my templates.



Aug 18, 2010 at 11:47 PM


The easiest way is to have a relative path (relative to the location of the .tt file that is) and convert it to absolute path using Host.ResolvePath method. The Host property is generated by T4 when you turn on the "hostspecific" parameter in the template directive. With T4 Toolbox, you can also use TransformationContext.Host.ResolvePath.

Hope this helps,

Aug 24, 2010 at 11:23 AM

Ok, thx!