Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++ transform T4 template ignore output file

Tags:

t4

I'm using TextTransform.exe to generate multiple C++ files. Since the tool is not supported directly within Visual Studio for C++ projects I call it by command line (inspired by T4 Generating C++ Code).

In order to generate multiple files I use https://github.com/areve/Entity-Framework-T4-Templates/blob/master/src/dev/MultiOutput.tt that's why I don't need the standard output which is normal generated by the tool.

I call TextTransform.exe like:

"C:\Program Files (x86)\Common Files\microsoft shared\TextTemplating\14.0\TextTransform.exe"
-out "<what to put here that NO file is generated?>"
C:\Test.tt

I'm using Microsoft Windows. Maybe there is a "hack" to provide any kind of special char which would be accepted by the program but it wouldn't be possible to actually create a file out of it.

Is there a possibility to provide any command which generates NO file when I execute this command?


Update

As mentioned by @ImprobabilityCast using NUL is a way to go. It's not producing any file but the custom build where I run the tt file with is failing with the message:

Performing Custom Build Tools
CUSTOMBUILD : error : FileStream will not open Win32 devices such as disk partitions and tape drives. Avoid use of "\\.\" in the path.

I reach what I want but it's not so "nice" that the build action is failing.

like image 807
Bruno Bieri Avatar asked Dec 08 '17 09:12

Bruno Bieri


1 Answers

Not sure why you don't want the files, but...

In linux we have a wonderful thing called /dev/null that is essentially an empty void just for things like this. I did a quick search, and Windows has it's own equivilent: NUL

Thus, the command you want is:

"C:\Program Files (x86)\Common Files\microsoft shared\TextTemplating\14.0\
TextTransform.exe" -out NUL C:\Test.tt
like image 97
ImprobabilityCast Avatar answered Oct 10 '22 19:10

ImprobabilityCast