Search code examples
visual-studiocode-generationt4

For what purposes have YOU used T4?


T4 has existed for several years in Visual Studio, but doesn't get a lot of attention. However, for those that know it, there seems to be some very creative and useful purposes.

I am researching some different ways that T4 is used, and I would appreciate to hear how YOU may have used it for real life scenarios. I am primarily interested in non-standard and creative uses.

Some interesting examples:

  1. Phil Haack uses T4 to create static CSS files from .less
  2. To Generate WPF and Silverlight Dependency Properties using T4 Templates

Note: I realize this is a discussion-oriented question, but the answers could be helpful to others. I have tagged it as subjective and also marked as "community wiki", so please allow the question to remain open. Thanks!


Solution

  • I've used the T4 Templates within the sharp-architecture to generate everything from models to controllers to basic views.

    Definitely worth checking out, even if you just want to see some advanced examples of T4 templates in action