在 MsBuild 中转换 TT 文件
我需要使用 MsBuild 构建 DSL 解决方案,并希望能够转换 TT 文件,我已经尝试了 http://msdn.microsoft.com/en-us/library/ee847423(VS.100).aspx 但我收到以下错误:
无法解析文件的包含文本:{0}
并且
正在加载包含文件“{0}” 返回 null 或空字符串。
MSDN 上有一个页面存在这些问题并提供了解决方案: http://msdn.microsoft.com/en-us/library/bb126242(VS.100).aspx 但并没有真正给我足够的信息来解决问题。
错误中需要注意的一件事是它具有以下路径:
错误 72 无法解析包含 文本为 文件:C:\source\XXXXXXXX\Dsl\GenerateCode\Dsl\ToolboxHelper.tt。 行=-1,列=-1 Dsl
但实际 TT 文件的位置是
C:\source\XXXXXXXX\Dsl\GenerateCode\ToolboxHelper.tt
I need to build a DSL Solution using MsBuild and want to be able to transform the TT files, I have tried the guide on http://msdn.microsoft.com/en-us/library/ee847423(VS.100).aspx but I am getting the following errors:
Failed to resolve include text for file:{0}
and also
Loading the include file '{0}'
returned a null or empty string.
There is a page on MSDN which has these issues and there resolutions : http://msdn.microsoft.com/en-us/library/bb126242(VS.100).aspx but don't really give me enough information to resolve the issue.
One thing to note in the error it has the following path:
Error 72 Failed to resolve include
text for
file:C:\source\XXXXXXXX\Dsl\GeneratedCode\Dsl\ToolboxHelper.tt.
Line=-1, Column=-1 Dsl
but the location of the actual TT file is
C:\source\XXXXXXXX\Dsl\GeneratedCode\ToolboxHelper.tt
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这是我在 MSDN 上得到的答案:
在 MsBuild 中转换 TT 文件
This was answered for me on MSDN:
Transforming TT files in MsBuild
对我来说,这是通过安装“T4 Toolbox for Visual Studio 2015”扩展来解决的。显然我只安装了 T4 编辑器。
For me, this was fixed by installing the "T4 Toolbox for Visual Studio 2015" extension. Apparently I only had the T4 editor installed.
从历史上看,T4 和 MSBuild 之间的故事一直很糟糕。现在,在 VS 2010 中,他们引入了预处理模板。如果您正在使用 VS 2010,您应该考虑使用它们。
Historically the story between T4 and MSBuild has been bad. Now with VS 2010 they are introducing Preprocessed templates. If you are using VS 2010 you should take a look at using those.