BT

InfoQ Homepage News Multiple Output Files using T4

Multiple Output Files using T4

Bookmarks

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.

Rate this Article

Adoption
Style

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.

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

Community comments

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

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

BT

Is your profile up-to-date? Please take a moment to review and update.

Note: If updating/changing your email, a validation request will be sent

Company name:
Company role:
Company size:
Country/Zone:
State/Province/Region:
You will be sent an email to validate the new email address. This pop-up will close itself in a few moments.