C#C
C#3y ago
26 replies
Exeteres

✅ Roslyn Emit API and Source Generators

Hello guys, I'm looking for someone who has some experience with Roslyn API.
I want to track file changes inside a project and emit a new assembly each time.
The problem here is that just changing the syntax trees of the source code (ReplaceSyntaxTree) does not change the dependent syntax trees generated by source generators.
So, the compilation uses outdated generated syntax trees and fails.
For now, I believe that I can regenerate missing/outdated files by implicitly using GeneratorDriver, but I have not find a good way to access the driver of the project/solution.
I hope you will have some ideas.
image.png
Was this page helpful?