Problem
I have this directive in my .tt file:
<#@ output extension=".gen.cs" #>
When using VS or Rider's built-in text templating, this produces an output <filename>.gen.cs. But when using T4.Build, it outputs <filename>.gen.gen.cs.
Solution (my guess)
I don't know how to debug an msbuild task, but looking through the code it appears this is caused by (T4.Build) BuildTemplateGenerator.OutputFile doing a Path.ChangeExtension before (Mono.TextTemplating) TemplateGenerator.SetFileExtension does the same thing.
When using an ordinary extension (.xyz) the double-call doesn't change anything. When using a doubled extension (.xyz.abc) the "sub"-extension gets doubled up, resulting in the <filename>.gen.gen.cs I mentioned above.
My guess on a fix would be, within BuildTemplateGenerator.OutputFile, to only change extension if no output directive is found.