【问题标题】:Get Generated Code's File Path in Visual Studio?在 Visual Studio 中获取生成代码的文件路径?
【发布时间】:2011-02-11 02:20:39
【问题描述】:

在 Visual Studio 中使用代码生成模板时,是否可以在“自定义工具”运行时获取 .tt 文件的当前位置?假设我的自定义模板位于

c:\projects\something\template.tt

当它施展魔法时,有没有办法返回上面的路径?

<#=PathOfCurrentTTFile #>

(因此 PathOfCurrentTTFile == c:\projects\something\template.tt)

【问题讨论】:

    标签: .net visual-studio templates code-generation t4


    【解决方案1】:

    看看this article。 Host.TemplateFile 有一些用途,这可能是您正在寻找的。​​p>

    【讨论】:

      猜你喜欢
      • 2011-02-13
      • 2020-01-10
      • 2012-07-06
      • 2010-11-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-04-17
      • 1970-01-01
      相关资源
      最近更新 更多