Roslyn Code Quoter updated to work with September 2012 CTP

I’ve blogged before about the tool called Quoter that shows how to use the Roslyn Syntax APIs to construct syntax trees manually:

I’ve updated the source to work with the latest (September 2012) Roslyn CTP:

Apart from several API changes I’ve also made it remove redundant calls, such as calls to insert { and } into new type declarations (they’re added by default already). Thus, the generated code is now shorter. For the source code “class C { }” we now generate:


which is way shorter than it used to be. I also made it not preserve whitespace/formatting by default (it will now generate trees without whitespace and then apply default formatting). If you’d like to preserve the exact whitespace of your source program, you need to set UseDefaultFormatting = false.