如何不输出默认的 T4 生成文件?

编程入门 行业动态 更新时间:2024-10-11 09:21:10
本文介绍了如何不输出默认的 T4 生成文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我使用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屋!

更多推荐

[db:关键词]

本文发布于:2023-05-01 11:49:21,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1408968.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文件

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!