How not to output default T4 generated file?

◇◆丶佛笑我妖孽 提交于 2019-11-30 16:58:07

Found a trick/hack!

<#@ output extension="/" #>

or

<#@ output extension="\\" #>

Visual Studio 2012 neither outputs the default file, nor complains about its inability too much.

P.S. I've tried it with T4MultiFile NuGet package, but it should work with T4Toolbox too, I think.

Right click on x.t4 in Solution Explorer and click Properties. It will say "TextTemplatingFileGenerator" beside Custom Tool. Delete this.

x.t4 will now be part of your project but it will not generate anything. This is useful when the .t4/.tt file is only being used as an include file in other templates.

No. This file is created by Visual Studio and not by T4. The best you can do is generate something useful in it such as actual code or, perhaps, a log of the code generation run.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!