如何获取要在Visual Studio中构建的t4文件? [英] How to get t4 files to build in visual studio?
问题描述
构建c#解决方案时,.tt文件不会创建.cs文件输出.但是,如果我在解决方案资源管理器中一次右键单击.tt文件,然后选择运行自定义工具",则会生成.cs,因此构建工具设置正确.我该怎么做才能构建整体解决方案以强制自定义工具在.tt文件上运行?
When I build my c# solution the .tt files will not create the .cs file outputs. But if I right click the .tt files one at a time in solution explorer and select "Run Custom Tool" the .cs is generated, so the build tool setting is correct. What do I do to get the overall solution build to force the custom tool to run on the .tt files?
推荐答案
Paul,您还可以在构建时使用埃尔顿·斯通曼(Elton Stoneman)的MSBuild任务.只需记住内置指令的行为,例如汇编 include 有所不同.命令行主机.
Paul, you can also generate code at build time with TextTransform.exe or Elton Stoneman's MSBuild task. Just keep in mind that behavior of the built-in directives, like assembly and include is different when T4 runs in Visual Studio vs. the command-line host.
这篇关于如何获取要在Visual Studio中构建的t4文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!