Get Project or Relative Directory with T4

前端 未结 2 1246
北海茫月
北海茫月 2021-01-30 20:51

How can I get a reference to the directory of the visual studio project or solution or the directory of the t4 template from within a t4 template?

I have a template that

2条回答
  •  一向
    一向 (楼主)
    2021-01-30 20:59

    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") #>
    

提交回复
热议问题