如何不输出默认的 T4 生成文件? [英] How not to output default T4 generated file?

查看:21
本文介绍了如何不输出默认的 T4 生成文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用T4toolbox生成一堆文件,假设我的t4文件名是x.t4,但默认生成一个x.txt,里面什么都没有,我可以告诉t4引擎不要这样做吗?

I am using T4toolbox to generate a bunch of files, let's say my t4 file name is x.t4, but default it generate a x.txt, which has nothing inside, can I tell t4 engine not to do this?

推荐答案

发现了一个技巧/窍门!

Found a trick/hack!

<#@ output extension="/" #>

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

Visual Studio 既不会输出默认文件,也不会过多抱怨它的无能.

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

如果想避免警告,也可以通过扩展修改输出路径:

If you want to avoid warnings, you can also modify output path through the extension:

<#@ output extension="xml/../_" #>

该文件仍将创建并附加到 Visual Studio 项目层次结构中的 T4 文件,但您可以将其放入任何目录.

The file will still be created and attached to the T4 file within the project hierarchy in Visual Studio, but you can put it into any directory.

附言我已经尝试过使用 T4MultiFile NuGet 包,但我认为它也应该适用于 T4Toolbox.

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

这篇关于如何不输出默认的 T4 生成文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆