BT

Multiple Output Files using T4

by Jonathan Allen on Nov 10, 2009 |

T4 is Visual Studio’s built-in code generator. Though fundamental for many of the frameworks built atop .NET, it is none the less incredibly under-powered. Even the simplest things like intelligently reusing templates or emitting multiple files seem beyond it at first glance. Yet developers are finding of ways to incrementally improve it. One such developer, Damien Guard, has built an extension to solve the multiple-output limitation.

Damien Guard’s Manager class takes over control of rendering the output so that it can be split into multiple files. Implemented as a template file itself, it is both easy to understand and yet quite clever. Out of the box it supports useful things like common headers and footers that are applied to all files in the set.

Damien recently published an improved version of his manager class. The most important change is its improved support for source control. It will now check to see if files have changed before writing them to disk. If a file has changed, it will be automatically checked out. There are also some internal improvements to reduce conflicts with other plugins that may be watching for changing files.

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss

Educational Content

General Feedback
Bugs
Advertising
Editorial
InfoQ.com and all content copyright © 2006-2014 C4Media Inc. InfoQ.com hosted at Contegix, the best ISP we've ever worked with.
Privacy policy
BT