Get Project or Relative Directory with T4
See The Host Specific Parameter section HERE.
This snippet shows how to get the full path of src relative to the template.
<#@ template hostspecific="true" #>
// The location of the src folder relative to the t4 template:
// <#= Host.ResolvePath("src") #>
You can grab the path like this aswell
<#@ template hostspecific="true" #>
<#= Path.GetDirectoryName(this.Host.TemplateFile) #>