Debugging T4 Templates

NB: This post is relevant to Visual Studio 2010

T4 templates are a great way to write code that writes code. Huh? I’m not going to go into it here, so if you want more information, see Scott Hanselman’s post on T4 templates, as well as Oleg Synch’s posts.

One of the pain points when writing T4 templates is with debugging them. Sometimes you’ll save a .tt file and get some obscure error message that is impossible to figure out, and you have no clue what part of your T4 file is messed up.

It is possible to debug them, and Oleg provides some great pointers. Here is my summary of how to get it working:

Read More