每个模板 TransformOnBuild 设置的 t4 模板
我想在构建项目时自动执行其中一个 .tt 文件,而不是其他文件。是否可以在特定的 .tt 文件而不是项目范围内设置 TransformOnBuild 属性?或者另一种方法来实现这一点?
I would like to automatically execute one of the .tt files when my project is built, but not the others. Is it possible to set the TransformOnBuild property on specific .tt files instead of project wide? Or another method to accomplish this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我决定添加自定义预构建步骤来生成所需的 .tt 文件:
此方法还允许我使用 -a 轻松地将参数(在项目文件中定义)传递到模板;我面临的另一个问题。
I have decided to add a custom pre build step to generate the .tt files needed:
This method also allowed me to easily pass parameters (defined in the project file) to the template with -a; another problem I was facing.
回答作为实现此目的的另一种方法。
(这里描述得更好:
http://www.olegsych.com/2009/09/t4-预处理文本模板/)。
第一个链接包含此示例,但它描述了预处理类的使用:
http://blogs.clariusconsulting.net/pga/ vs10-beta-1-t4-preprocessing-part-2/
Answering as another method to accomplish this.
(descibed better here:
http://www.olegsych.com/2009/09/t4-preprocessed-text-templates/).
The first link includes this example, but it describes the use of preprocessed class:
http://blogs.clariusconsulting.net/pga/vs10-beta-1-t4-preprocessing-part-2/