How to get a project's directory from within T4?
Posted
by
Earlz
on Stack Overflow
See other posts from Stack Overflow
or by Earlz
Published on 2010-12-30T08:18:17Z
Indexed on
2010/12/30
8:54 UTC
Read the original article
Hit count: 394
I've been messing around with T4 support in Mono and noticed a very cumbersome thing. The current directory when running T4 templates is the home directory. I need to be able to read a few files from the current project's directory but I'm at a loss for how to.
<#@ template language="C#v3.5" #>
<#@ output extension="txt" #>
<#=System.IO.Directory.GetCurrentDirectory() #>
yields
/home/earlz
where I want it to yield something like
/home/earlz/MyProject
How do I overcome this problem?
Also, I tried the hostspecific and Host.ResolvePath, but I got a NotImplementedException
© Stack Overflow or respective owner