The output path for the general T4 template

How to specify the output path of the T4 template?

When I add my T4 template using Add as Link to my project from $TemplatePath$ , it generates an output file in $TemplatePath$ , not $ProjectPath$ . How can I indicate that $ProjectPath is where the generated file is located?

+8
visual-studio t4
source share
2 answers

I went around this by creating a master template in one place, and then templates that imported this (but a bit more) into each project. Of course, this is not the most pleasant solution.

+7
source share

Usually we use the same system that Jeff Yates mentioned with minimal (often single-line) stub patterns, including a common pattern.

You can also use Oleg Sych T4Toolbox to output the project to any directory that you like.

However, the standard IVsSingleFileGenerator on which the custom T4 tool is built does not have any dials to access output location management, and this is the case for linked files as you describe.

+1
source share

Source: https://habr.com/ru/post/650981/


All Articles