Can I use Roslyn for compile time code rewriting?

Compile time re-writing isn’t directly supported by Roslyn today, but syntactic and semantic transformations definitely are. In fact, take a look at the “ImplementNotifyPropertyChanged” sample included in the CTP to see something of what you want to do. The sample is implemented as a design time transformation in and IDE feature, but you can extract the logic and make it into something like a pre-build task that rewrites files before compilation.

Leave a Comment