How to execute T4 template files in Visual Studio For Mac?

Viewed 468

I am unable to run text templates in Visual Studio for Mac or visual studio code. I tried:

VS > Right click project > Tools > Process T4 templates > (No Templates Found)

I also went to Visual Studio top menu > Extensions > (Search for T4) > IDE Extensions > Text Templating v8.10.6 is installed.

I am trying to use the *.tt template from linq2db.SqlServer.. But running any basic T4 template would let me know the TextTemplatingFileGenerator is at least working. There the documentation states:

Make sure that custom tool for your tt file set to TextTemplatingFileGenerator, otherwise it will not run

Though it doesn't explain how to actually accomplish this task?

I also installed TT-Processor into visual studio code. I was also unable to execute the *.tt file. In this case I did not see an execute/run command when I right clicked a *.tt file.

1 Answers

Microsoft answered the question for me. As I already mentioned, the part that nobody talks about is the answer to this:

Make sure that custom tool for your tt file set to TextTemplatingFileGenerator, otherwise it will not run

In visual studio right click the *.tt File > Properties > Custom Tool > Choose "TextTemplatingFileGenereator"

Now visual studio will find the *.tt file when you Right click the project > Tools > Process T4 templates

Arguably, this experience should be improved to default to this behavior to fit the philosophy of "fall into the pit of success".

Related