How to debug a code generator used by VS?

In my case, I wanted to debug my edmx CodeGen but you can do it for a lot of other cases.

So how to debug your CodeGen?

I think there is probably a better way but this is what I did:

In my CodeGen, I put a MessageBox.Show

  • I open 2 VS: one with my CodeGen code and one with the project which will run the CodeGen
  • In the second VS, I run the CodeGen (for the edmx CodeGen, I change the Custom Tool value). The generation pauses with the MessageBox
  • I go to the first VS, I attach the second devenv process. Then I put a breakpoint after the MessageBox.Show
  • I go back to the second VS and I validate the MessageBox
  • I go back to my first projet. I am on my breapoint and I can now debug my code generator

Nice isn’t it? [;)]

This entry was posted in 7671, 7675, 8606. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *