title: Ascertaining Project Directory from T4 Templates
body: <p>I am using T4 templates in Visual Studio for code generation, and am trying to reference a local .xml file from the template code so I can parse it for metadata about the application's data model.</p>
  
  <p>When the template code (which runs at compile time or when you run "Execute Custom Tool" on the template) tries to obtain the current path through Environment.CurrentDirectory, I get this:</p>
  
  <p>c:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE</p>
  
  <p>I'm really trying to find the path of the template itself, within the project, so that I can use relative pathing to find the .xml file that's driving it.  Any ideas?</p>