This project is read-only.

Roslyn as a T4 Replacement?

Topics: General
Dec 27, 2014 at 11:30 PM
Edited Dec 27, 2014 at 11:40 PM
Hello Community,

(I apologize if this information is readily available somewhere. I did a search for "code generation" in the forums and it did not have an obvious topic.)

I have been searching for a solid code generation solution for my codebase. I have lots of (really bad) experience with T4, and it is with much regret that I have been getting back into that and seriously considering it as a solution.

On a whim, I did a search for code generation with Roslyn and found this article:
http://www.softwire.com/blog/2012/06/28/code-generation-in-net-with-the-roslyn-ctp-part-1/

It's based on earlier technology (and two years old), but I am curious if this got any legs under it and/or is expected to ship with Roslyn in its current state.

I cannot underscore how terrible T4 is. Not only does the technology feel like it's developed by a team of interns, the community and documentation around it pretty absent these days. It would be nothing short of awesome to have this available with a new technology and the community found here supporting it. :)

Thank you for any assistance/insight and Happy Holidays,
Michael
Dec 30, 2014 at 7:50 PM
You can use Roslyn for code generation, but it wasn't meant to be used for that and so it's not very good at it. IMO, the main problem is that it's way too verbose.

But a library based on Roslyn (possibly something like RoslynDOM) could solve those issues.
Dec 30, 2014 at 8:47 PM
Hmmm... interesting. I'll check that out. Seems like there really isn't a good path here. Either wait a few years before a viable product is released, or deal with T4 in the meantime. Yuck. Seriously, an army of interns, I say!

Thanks. :)
Michael