How not to output default T4 generated file?

后端 未结 3 616
不知归路
不知归路 2020-12-30 20:33

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

3条回答
  •  执笔经年
    2020-12-30 20:58

    Found a trick/hack!

    <#@ output extension="/" #>
    

    or

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

    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/../_" #>
    

    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.

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

提交回复
热议问题