Get Project or Relative Directory with T4

泪湿孤枕 提交于 2019-12-02 16:08:10
Blake Taylor

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) #>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!