How to use T4 to generate two files at the same time from one template?
Asked Answered
J

1

15

I am having a case in which I need to generate two CSharp code files with pretty the same code but different namespace of the input and output types of the methods. In fact each file is for a specific country and the types come from country specific WSDL's.

I am writing some wrappers around the services and the logic is exactly the same but the types automatically generated from WSDL's are different. How could I reduce the coding effort and write the logic at one place and get it generated for two different sets of types?

Journalistic answered 20/1, 2011 at 10:49 Comment(0)
A
10

or you could use the T4 Toolbox (Old CodePlex project, New GitHub project) and use the helpers to generate multiple files.

The author, Oleg Sych, has a documentary blog post (Archived version)

Or if you don't want this dependency just for this functionality, you can use the T4 file MultiOutput.tt (Archived version)

Alisander answered 20/1, 2011 at 11:53 Comment(2)
The link for the T4 MultiOutput.tt file is dead. Is there another link to this out there?Bibliology
Try this alternate link instead: damieng.com/blog/2009/01/22/multiple-outputs-from-t4-made-easyNatatory

© 2022 - 2024 — McMap. All rights reserved.