© Nick Harrison 2017

Nick Harrison, Code Generation with Roslyn, 10.1007/978-1-4842-2211-9_6

6. Deploying Generated Code

Nick Harrison

(1)Lexington, South Carolina, USA

So far, we have simply written the generated code to the screen, but this is hardly the only option. Remember Roslyn is the compiler. When you have a generated SyntaxTree, you are already partway through compilation.

To facilitate taking the process from SyntaxTree to compiled assembly, we will start with a simple solution preloaded with the needed references and an empty project. Only code that you generate will be in this project.

Note

Supporting code like the interfaces used as parameters should be defined in a separate assembly, accessed by both the generated code and the code using ...

Get Code Generation with Roslyn now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.