Files
mROA/mROA.Codegen/Readme.md
T

29 lines
1.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Roslyn Source Generators Sample
A set of three projects that illustrates Roslyn source generators. Enjoy this template to learn from and modify source generators for your own needs.
## Content
### mROA.Codegen
A .NET Standard project with implementations of sample source generators.
**You must build this project to see the result (generated code) in the IDE.**
- [SampleSourceGenerator.cs](SampleSourceGenerator.cs): A source generator that creates C# classes based on a text file (in this case, Domain Driven Design ubiquitous language registry).
- [SampleIncrementalSourceGenerator.cs](SampleIncrementalSourceGenerator.cs): A source generator that creates a custom report based on class properties. The target class should be annotated with the `Generators.ReportAttribute` attribute.
### mROA.Codegen.Sample
A project that references source generators. Note the parameters of `ProjectReference` in [mROA.Codegen.Sample.csproj](../mROA.Codegen.Sample/mROA.Codegen.Sample.csproj), they make sure that the project is referenced as a set of source generators.
### mROA.Codegen.Tests
Unit tests for source generators. The easiest way to develop language-related features is to start with unit tests.
## How To?
### How to debug?
- Use the [launchSettings.json](Properties/launchSettings.json) profile.
- Debug tests.
### How can I determine which syntax nodes I should expect?
Consider installing the Roslyn syntax tree viewer plugin [Rossynt](https://plugins.jetbrains.com/plugin/16902-rossynt/).
### How to learn more about wiring source generators?
Watch the walkthrough video: [Lets Build an Incremental Source Generator With Roslyn, by Stefan Pölz](https://youtu.be/azJm_Y2nbAI)
The complete set of information is available in [Source Generators Cookbook](https://github.com/dotnet/roslyn/blob/main/docs/features/source-generators.cookbook.md).