├── .github
└── CODEOWNERS
├── LICENSE
└── README.md
/.github/CODEOWNERS:
--------------------------------------------------------------------------------
1 | * @amis92
2 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Creative Commons Legal Code
2 |
3 | CC0 1.0 Universal
4 |
5 | CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
6 | LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
7 | ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
8 | INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
9 | REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
10 | PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
11 | THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
12 | HEREUNDER.
13 |
14 | Statement of Purpose
15 |
16 | The laws of most jurisdictions throughout the world automatically confer
17 | exclusive Copyright and Related Rights (defined below) upon the creator
18 | and subsequent owner(s) (each and all, an "owner") of an original work of
19 | authorship and/or a database (each, a "Work").
20 |
21 | Certain owners wish to permanently relinquish those rights to a Work for
22 | the purpose of contributing to a commons of creative, cultural and
23 | scientific works ("Commons") that the public can reliably and without fear
24 | of later claims of infringement build upon, modify, incorporate in other
25 | works, reuse and redistribute as freely as possible in any form whatsoever
26 | and for any purposes, including without limitation commercial purposes.
27 | These owners may contribute to the Commons to promote the ideal of a free
28 | culture and the further production of creative, cultural and scientific
29 | works, or to gain reputation or greater distribution for their Work in
30 | part through the use and efforts of others.
31 |
32 | For these and/or other purposes and motivations, and without any
33 | expectation of additional consideration or compensation, the person
34 | associating CC0 with a Work (the "Affirmer"), to the extent that he or she
35 | is an owner of Copyright and Related Rights in the Work, voluntarily
36 | elects to apply CC0 to the Work and publicly distribute the Work under its
37 | terms, with knowledge of his or her Copyright and Related Rights in the
38 | Work and the meaning and intended legal effect of CC0 on those rights.
39 |
40 | 1. Copyright and Related Rights. A Work made available under CC0 may be
41 | protected by copyright and related or neighboring rights ("Copyright and
42 | Related Rights"). Copyright and Related Rights include, but are not
43 | limited to, the following:
44 |
45 | i. the right to reproduce, adapt, distribute, perform, display,
46 | communicate, and translate a Work;
47 | ii. moral rights retained by the original author(s) and/or performer(s);
48 | iii. publicity and privacy rights pertaining to a person's image or
49 | likeness depicted in a Work;
50 | iv. rights protecting against unfair competition in regards to a Work,
51 | subject to the limitations in paragraph 4(a), below;
52 | v. rights protecting the extraction, dissemination, use and reuse of data
53 | in a Work;
54 | vi. database rights (such as those arising under Directive 96/9/EC of the
55 | European Parliament and of the Council of 11 March 1996 on the legal
56 | protection of databases, and under any national implementation
57 | thereof, including any amended or successor version of such
58 | directive); and
59 | vii. other similar, equivalent or corresponding rights throughout the
60 | world based on applicable law or treaty, and any national
61 | implementations thereof.
62 |
63 | 2. Waiver. To the greatest extent permitted by, but not in contravention
64 | of, applicable law, Affirmer hereby overtly, fully, permanently,
65 | irrevocably and unconditionally waives, abandons, and surrenders all of
66 | Affirmer's Copyright and Related Rights and associated claims and causes
67 | of action, whether now known or unknown (including existing as well as
68 | future claims and causes of action), in the Work (i) in all territories
69 | worldwide, (ii) for the maximum duration provided by applicable law or
70 | treaty (including future time extensions), (iii) in any current or future
71 | medium and for any number of copies, and (iv) for any purpose whatsoever,
72 | including without limitation commercial, advertising or promotional
73 | purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
74 | member of the public at large and to the detriment of Affirmer's heirs and
75 | successors, fully intending that such Waiver shall not be subject to
76 | revocation, rescission, cancellation, termination, or any other legal or
77 | equitable action to disrupt the quiet enjoyment of the Work by the public
78 | as contemplated by Affirmer's express Statement of Purpose.
79 |
80 | 3. Public License Fallback. Should any part of the Waiver for any reason
81 | be judged legally invalid or ineffective under applicable law, then the
82 | Waiver shall be preserved to the maximum extent permitted taking into
83 | account Affirmer's express Statement of Purpose. In addition, to the
84 | extent the Waiver is so judged Affirmer hereby grants to each affected
85 | person a royalty-free, non transferable, non sublicensable, non exclusive,
86 | irrevocable and unconditional license to exercise Affirmer's Copyright and
87 | Related Rights in the Work (i) in all territories worldwide, (ii) for the
88 | maximum duration provided by applicable law or treaty (including future
89 | time extensions), (iii) in any current or future medium and for any number
90 | of copies, and (iv) for any purpose whatsoever, including without
91 | limitation commercial, advertising or promotional purposes (the
92 | "License"). The License shall be deemed effective as of the date CC0 was
93 | applied by Affirmer to the Work. Should any part of the License for any
94 | reason be judged legally invalid or ineffective under applicable law, such
95 | partial invalidity or ineffectiveness shall not invalidate the remainder
96 | of the License, and in such case Affirmer hereby affirms that he or she
97 | will not (i) exercise any of his or her remaining Copyright and Related
98 | Rights in the Work or (ii) assert any associated claims and causes of
99 | action with respect to the Work, in either case contrary to Affirmer's
100 | express Statement of Purpose.
101 |
102 | 4. Limitations and Disclaimers.
103 |
104 | a. No trademark or patent rights held by Affirmer are waived, abandoned,
105 | surrendered, licensed or otherwise affected by this document.
106 | b. Affirmer offers the Work as-is and makes no representations or
107 | warranties of any kind concerning the Work, express, implied,
108 | statutory or otherwise, including without limitation warranties of
109 | title, merchantability, fitness for a particular purpose, non
110 | infringement, or the absence of latent or other defects, accuracy, or
111 | the present or absence of errors, whether or not discoverable, all to
112 | the greatest extent permissible under applicable law.
113 | c. Affirmer disclaims responsibility for clearing rights of other persons
114 | that may apply to the Work or any use thereof, including without
115 | limitation any person's Copyright and Related Rights in the Work.
116 | Further, Affirmer disclaims responsibility for obtaining any necessary
117 | consents, permissions or other rights required for any use of the
118 | Work.
119 | d. Affirmer understands and acknowledges that Creative Commons is not a
120 | party to this document and has no duty or obligation with respect to
121 | this CC0 or use of the Work.
122 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # C# Source Generators
2 |
3 | * [Documentation and samples](#documentation-and-samples)
4 | * [Source Generators](#source-generators)
5 | * [Meta - libs and generators for other generators](#meta---libs-and-generators-for-other-generators)
6 | * [Tips & Tricks](#tips--tricks)
7 | * [Articles](#articles)
8 | * [Videos](#videos)
9 | * [Demo, PoC and excercise projects](#demo-poc-and-excercise-projects)
10 | * [Projects using custom Source Generators "internally"](#projects-using-custom-source-generators-internally)
11 |
12 | ---
13 |
14 | A list of C# Source Generators (not necessarily awesome), because I haven't found a good list yet.
15 |
16 | **C# Source Generators** is a Roslyn compiler feature introduced in C#9/.NET 5. It lets C# developers inspect user code and generate new C# source files that can be added to a compilation.
17 |
18 | Add GitHub topic [`csharp-sourcegenerator`](https://github.com/topics/csharp-sourcegenerator) to your generator repo - let's get it started!
19 |
20 | ## Documentation and samples
21 |
22 | - [docs.microsoft.com](https://docs.microsoft.com/en-us/dotnet/csharp/roslyn-sdk/source-generators-overview) official documentation.
23 | - [dotnet/roslyn feature design document](https://github.com/dotnet/roslyn/blob/main/docs/features/source-generators.md) describing the compiler feature.
24 | - [dotnet/roslyn cookbook](https://github.com/dotnet/roslyn/blob/main/docs/features/source-generators.cookbook.md) to help with generator creation.
25 | - [dotnet/roslyn-sdk samples](https://github.com/dotnet/roslyn-sdk/tree/main/samples/CSharp/SourceGenerators) show how to implement a source generator and use features like external package references (*inside* generators). Includes AutoNotify, Csv, Maths, Mustache, and SettingsXml.
26 | - [SourceGeneratorPlayground](https://wengier.com/SourceGeneratorPlayground) - an online Source Generator Playground to play with generator ideas 💡 without any setup noise. [Source repo](https://github.com/davidwengier/SourceGeneratorPlayground).
27 | - [davidwengier/SourceGeneratorTemplate](https://github.com/davidwengier/SourceGeneratorTemplate) -  A basic template for writing a C# source generator, from the Roslyn dev.
28 |
29 | ## Source Generators
30 |
31 |
32 | Categories
33 |
34 | - [Dependency Injection (IoC Container)](#dependency-injection-ioc-container)
35 | - [Console / CLI](#console--cli)
36 | - [Mappers](#mappers)
37 | - [Communication](#communication)
38 | - [Graphics / Drawing](#graphics--drawing)
39 | - [Enums](#enums)
40 | - [Functional Programming](#functional-programming)
41 | - [Value semantic / New Type Idiom](#value-semantic--new-type-idiom)
42 | - [Immutability](#immutability)
43 | - [Discriminated Unions](#discriminated-unions)
44 | - [Serialization](#serialization)
45 | - [Json](#json)
46 | - [Validation](#validation)
47 | - [Localization](#localization)
48 | - [Testing](#testing)
49 | - [Mocking](#mocking)
50 | - [Patterns](#patterns)
51 | - [Mediator](#mediator)
52 | - [Command](#command)
53 | - [Builder](#builder)
54 | - [Proxy](#proxy)
55 | - [Visitor](#visitor)
56 | - [Adapter](#adapter)
57 | - [Domain Driven Design (DDD)](#domain-driven-design-ddd)
58 | - [Metaprogramming](#metaprogramming)
59 | - [Webprogramming](#webprogramming)
60 | - [Open Api](#open-api)
61 | - [Razor / Blazor](#razor--blazor)
62 | - [XAML / WPF / Avalonia](#xaml--wpf--avalonia)
63 | - [INotifyPropertyChanged](#inotifypropertychanged)
64 | - [Model View Viewmodel (MVVM)](#model-view-viewmodel-mvvm)
65 | - [Database / ORM](#database--orm)
66 | - [Statically typed resources / configurations](#statically-typed-resources--configurations)
67 | - [Other](#other)
68 |
69 |
70 |
71 |
75 |
76 | ### Dependency Injection (IoC Container)
77 |
78 | - [AutoCtor](https://github.com/distantcam/AutoCtor) -   AutoCtor is a Roslyn Source Generator that will automatically create a constructor for your class for use with constructor Dependency Injection.
79 | - [SourceDepend](https://github.com/crwsolutions/sourcedepend) -   Simply tag members with a `[Dependency]` attribute and those will be added to the constructor, saving you from manual coding the constructor.
80 | - [AutoRegisterInject](https://github.com/patrickklaeren/AutoRegisterInject) -   Automatically generate Microsoft Dependency Injection ServiceCollection registrations for your classes from attributes.
81 | - [DependencyInjection.SourceGenerators](https://github.com/jimmy-mll/DependencyInjection.SourceGenerators)   This project is a C# source generator designed to simplify and automate the registration of dependencies in Microsoft's Dependency Injection service collection. By using this package, developers can enhance the clarity and efficiency of their code by reducing the need for manual service registration.
82 | - [DependencyManagement](https://github.com/essy-ecosystem/dependency-management) -   The Dependency Management is a very fast dependency injection and components container, with many interesting features, and without reflection.
83 | - [GrpcInjection](https://github.com/juniorporfirio/grpcinjection) -  - GrpcInjection is a tool that allow you to inject Services and Interceptor in time of compilation inside of GRPC Projects using C# source generator.
84 | - [Injectio](https://github.com/loresoft/Injectio) -   - Source generator that helps register discovered services in the dependency injection container
85 | - [Jab](https://github.com/pakrym/jab) -  - Compile Time Dependency Injection
86 | - [lambdajection](https://github.com/cythral/lambdajection) -  Framework for building AWS Lambdas using dependency injection and aspect-oriented programming.
87 | - [MrMeeseeks.DIE](https://github.com/Yeah69/MrMeeseeks.DIE) -   An unambigous, convenient, flexible and feature rich compile time dependency injection container.
88 | - [Pure.DI](https://github.com/DevTeam/Pure.DI) -   - dependency injection for .NET without any IoC/DI containers, frameworks, dependencies, and thus without any performance impact and side-effects.
89 | - [SourceInject](https://github.com/giggio/sourceinject/) -  A source generator that allow you to generate your services for dependencies injection during compile time.
90 | - [StrongInject](https://github.com/YairHalberstadt/stronginject) -  - compile time dependency injection for .NET.
91 | - [Thunderboltloc](https://github.com/AlyElhaddad/ThunderboltIoc) -   One of the very first IoC frameworks for .Net that has no reflection.
92 | - [ServiceScan.SourceGenerator](https://github.com/Dreamescaper/ServiceScan.SourceGenerator) -   Type scanning source generator for `Microsoft.Extensions.DependencyInjection` services registrations inspired by [Scrutor](https://github.com/khellang/Scrutor/).
93 |
94 | ### Console / CLI
95 |
96 | - [AutoSpectre](https://github.com/jeppevammenkristensen/auto-spectre) -   Generates a service for prompting and populating a class using the Spectre.Console library
97 | - [docopt.net](https://github.com/docopt/docopt.net) -   generates C# source code that parses command-line arguments into a strong-typed arguments class (also generated), given _just_ the [POSIX-style usage in plain text](http://docopt.org/) as part of the CLI. In other words, write the help message for your program and get the entire parser generated for free!
98 | - [Figgle](https://github.com/drewnoakes/figgle) -   - Generate ASCII banner text at compile time (or run time) using figlet fonts.
99 |
100 | ### Mappers
101 |
102 | - [AutoDto](https://github.com/Ohorodnikov/AutoDto) -  - A source generator that generates DTO models from BL to avoid same BL and DTO models
103 | - [Flattening](https://github.com/Kros-sk/Kros.Generators.Flattening) -   - C# source generator for generating flattened classes from complex domain classes.
104 | - [GraphQL.Tools](https://github.com/MoienTajik/GraphQL.Tools) -  - A GraphQL to C# compiler (code-generator) which turns your GraphQL schema into a set of C# classes, interfaces, and enums.
105 | - [Mapperly](https://github.com/riok/mapperly) -  - A source generator for generating object mappings. Inspired by MapStruct.
106 | - [MappingCloningExtensions](https://github.com/musictopia2/MappingCloningExtensions) -   Generates extensions of objects for mapping and cloning using either attributes or fluent style. Also, supports deep copying and specfiying whether it can do a deep copy and the possibility of doing so safely.
107 | - [Mapster](https://github.com/MapsterMapper/Mapster) -  - A fast, fun and performant object to object Mapper. Has better performance and is more memorry efficient than Automapper. Besides code generation, supports also Fluent API.
108 | - [MapTo](https://github.com/mrtaikandi/MapTo) -  - A convention based object to object mapper similar to Automapper.
109 | - [NextGenMapper](https://github.com/DedAnton/NextGenMapper) -   Easy-to-use mapper without configuration.
110 | - [SourceMapper](https://github.com/alekshura/SourceMapper) -   - generates Mappers code based on attributes used on interfaces or abstract classes. It is inspired by Java [MapStruct](https://mapstruct.org/)
111 | - [SourceMapper](https://github.com/paiden/SourceMapper/) -  A source generator that creates extension methods for cloning and mapping.
112 |
113 | ### Communication
114 |
115 | - [CoreWCF](https://github.com/CoreWCF/CoreWCF) -  CoreWCF provides support of WCF server side code on .NET Core / .NET6. CoreWCF allows users to inject services into `OperationContract` implementation using a source generator to provide an `OperationContract` implementation that fits the expected `ServiceContract`. The supplied implementation fetch services from the DI container the same way the `[FromServices]` attribute works in ASP.NET core MVC Controllers. The source generator supports both a dedicated `[Injected]` attribute and the ASP.NET Core MVC `[FromServices]` attribute.
116 | - [Imp.NET](https://github.com/DouglasDwyer/Imp.NET) -  - a fast, high-level, object-oriented C# networking library that supports the invocation of remote methods through proxy interface objects.
117 | - [IoTHubClientGenerator](https://github.com/alonf/IoTHubClientGenerator) -   Build a C# Azure IoT Device client program in seconds!
118 |
119 | ### Graphics / Drawing
120 |
121 | - [ComputeSharp](https://github.com/Sergio0694/ComputeSharp) -  A .NET library to run C# code in parallel on the GPU through DX12 and dynamically generated HLSL compute shaders, which are transpiled from C# and precompiled at build-time using source generators.
122 | - [Svg to C# Source Generators](https://github.com/wieslawsoltes/Svg.Skia) -  SVGC compiles SVG drawing markup to C# using SkiaSharp as rendering engine. SVGC can be also used as codegen for upcoming C# 9 Source Generator feature.
123 |
124 | ### Enums
125 |
126 | - [BetterEnums](https://github.com/Ceiridge/BetterEnums) -   C# Enums with values and better performance as a source generator
127 | - [Credfeto.Enumeration.Source.Generation](https://github.com/credfeto/credfeto-enum-source-generation) -  Enum to text generator for enums - generates strongly typed enums for all enums in the assembly, and using `EnumText` attribute for third party enums. Also includes an analyzer to ensure that all enum usages use the `.GetName` extension method rather than `.ToString`.
128 | - [Enum.Source.Generator](https://github.com/EngRajabi/Enum.Source.Generator) -   A C# source generator to create an enumeration (enum) class from an enum type. With this package, you can work on enums very, very fast without using reflection.
129 | - [EnumClass](https://github.com/ashenBlade/EnumClass) -   Generate Kotlin's `enum class` from C# `enum` with additional features like Switch function (instead of `switch` statement). It also contains support libraries like generator for JsonConverter for generated classes
130 | - [EnumerationClassGenerator](https://github.com/HamedFathi/EnumerationClassGenerator) -  - A C# source generator to create an enumeration class from an enum type.
131 | - [EnumFastToStringDotNet](https://github.com/Spinnernicholas/EnumFastToStringDotNet) -  - Automatically generates enum extension methods that implement a switch expression based ToString method.
132 | - [EnumUtilitiesGenerator](https://github.com/leoformaggi/enum-utilities-generator) -  - A source generator to generate compile-time mapping of enums and description attributes.
133 | - [FastEnumGenerator](https://github.com/musictopia2/FastEnumGenerator) -   An enum like generator where you create a partial class with private enum and it will generate an enum like record struct even including returning the words and a list.
134 | - [JOS.Enumeration](https://github.com/joseftw/jos.enumeration) - Enumeration class powered by source generation
135 |
136 | ### Functional Programming
137 |
138 | #### Value semantic / New Type Idiom
139 |
140 | - [Generator.Equals](https://github.com/diegofrata/Generator.Equals) -   generates equality and hashing for classes and records, supports a number of strategies for comparing collections and properties.
141 | - [RSCG_UtilityTypes](https://github.com/ignatandrei/RSCG_UtilityTypes) -   Add Omit and Pick attributes to generate classes from existing class, like in TypeScript.
142 | - [Strongly](https://github.com/lucasteles/Strongly)   - Easily generate serializable domain value types
143 | - [ValueObjectGenerator](https://github.com/RyotaMurohoshi/ValueObjectGenerator) -   C# source generator is for ValueObjects (ie.Wrapper classes).
144 | - [Vogen](https://github.com/SteveDunn/Vogen) -   C# source generator and code analyser that generates strongly typed domain identities.
145 | - [WrapperValueObject](https://github.com/martinothamar/WrapperValueObject) -   - for creating simple value objects wrapping primitive types.
146 |
147 | #### Immutability
148 |
149 | - [Immutype](https://github.com/DevTeam/Immutype) -   - generates extension methods to support immutability.
150 | - [Visor](https://github.com/leviysoft/Visor) -   C# optics library with incremental code generator (maintained fork of [suspended Tinkoff project](https://github.com/Tinkoff/Visor))
151 |
152 | #### Discriminated Unions
153 |
154 | - [AnyOf](https://github.com/StefH/AnyOf) -   The Source Generator creates a `AnyOf` type to handle multiple defined types as input parameters for methods.
155 | - [dotVariant](https://github.com/mknejp/dotvariant) -   A type-safe and space-efficient sum type for C# (comparable to discriminated unions in C or C++).
156 | - [Dunet](https://github.com/domn1995/dunet) -   A simple source generator for [discriminated unions](https://en.wikipedia.org/wiki/Tagged_union) in C#.
157 | - [Funcky Discriminated Unions](https://github.com/polyadic/funcky-discriminated-union) -   A source generator that generates `Match` methods for all your discriminated unions needs. ✨ Can be used with or without the functional programming library Funcky.
158 | - [N.SourceGenerators.UnionTypes](https://github.com/Ne4to/N.SourceGenerators.UnionTypes) -   Discriminated union type source generator.
159 | - [Unions](https://github.com/PaulBraetz/Unions) -   for generating meaningful, efficient union types.
160 |
161 | ### Serialization
162 |
163 | - [AutoDeconstructable](https://github.com/nemesissoft/Nemesis.TextParsers/tree/master/Nemesis.TextParsers.CodeGen/Deconstructable) -  Generator for efficient and automatic flat text serializer/deserializer using [Deconstructable aspect](https://github.com/nemesissoft/Nemesis.TextParsers/blob/master/Specification.md#deconstructables) in [NTP](https://github.com/nemesissoft/Nemesis.TextParsers) library.
164 | - [Azura](https://github.com/Lucina/Azura) -  Generates binary [de]serializers on Streams at design time.
165 | - [CSV-Parser-Generator](https://github.com/LokiMidgard/CSV-Parser-Generator) -   A Parser for CSV with support for uncommon line separators (e.g. Unicode) and instantiation of read-only objects and working nullable handling.
166 | - [GenPack](https://github.com/dimohy/GenPack) -   is a library that uses the .NET source generator to automatically generate packets as classes once you define a schema for the packets. It's easy to use and the results are useful.
167 | - [ProtobufSourceGenerator](https://github.com/ladeak/ProtobufSourceGenerator) -  - A source generator that generates partial helper classes where member properties are attributed with ProtoMember attribute.
168 | - [SerdeDn (serde-sn)](https://github.com/agocke/serde-dn) -  is a port of the popular [serde.rs](https://serde.rs/) Rust serialization/deserialization library to .NET. Basic cases are fully automated using a C# source generator.
169 | - [SpreadCheetah](https://github.com/sveinungf/spreadcheetah) -  Create Excel files with a C# Source Generator for generating the rows.
170 | - [StackXML](https://github.com/ZingBallyhoo/StackXML) -  Stack based zero-allocation XML serializer and deserializer.
171 | - [StructPacker](https://github.com/RudolfKurka/StructPacker) -  binary serializer that auto-generates C# serialization code to achieve peak runtime performance and efficiency.
172 | - [Tinyhand](https://github.com/archi-Doc/Tinyhand) -  - Tiny and simple data format/serializer using a source generator.
173 |
174 | #### Json
175 |
176 | - [GeneratedJsonConverters](https://github.com/aviationexam/json-converter-source-generator) -  - generate json converters for polymorph contracts and string based enum serialization.
177 | - [JsonByExampleGenerator](https://github.com/hermanussen/JsonByExampleGenerator) -  - generate classes based on example json files in your project.
178 | - [JsonDeserializeResourceSourceGenerator](https://github.com/musictopia2/JsonDeserializeResourceSourceGenerator) -   Instead of having to do embedded resource, can instead have json as additional file and it will produce a c# string and will deserialize to a type specified.
179 | - [JsonPolymorphicGenerator](https://github.com/surgicalcoder/JsonPolymorphicGenerator) -   - Source Code Generator for System.Text.Json JsonDerivedType attributes on polymorphic classes
180 | - [JsonSerializerContextGenerator](https://github.com/musictopia2/JsonSerializerContextGenerator) -   A source generator that produces nearly the same code as system.json.text but easier to use because you only have to put an attribute for a model class you want to produce for. Also, produces a method to register to make it easy to use that source generator when serializing/deserializing json.
181 | - [JsonSrcGen](https://github.com/trampster/JsonSrcGen) -  - compile time JSON serializer generation.
182 | - [TeuJson](https://github.com/Terria-K/TeuJson) -   A Reflection-less and Lightweight Json Library using source generator.
183 |
184 | ### Validation
185 | - [Validly](https://github.com/Hookyns/validly) -  - A performant, zero-allocation, and highly customizable validation library that generates validation logic based on attributes, with usage similar to DataAnnotations.
186 |
187 | ### Localization
188 |
189 | - [kli.Localize](https://github.com/kl1mm/localize) -   - localize strings from json files via source code generation
190 | - [MrMeeseeks.ResXToViewModelGenerator](https://github.com/Yeah69/MrMeeseeks.ResXToViewModelGenerator) -   Takes ResX files and generates localization ViewModels for a more convenient usage of localization in MVVM projects.
191 | - [ResXGenerator](https://github.com/ycanardeau/ResXGenerator) -  Generates strongly-typed resource classes for looking up localized strings.
192 |
193 | ### Testing
194 |
195 | - [Buildenator](https://github.com/progala2/Buildenator) -  Generate data builder classes for testing purposes (and not only) for your entities. Autofixture + Moq extensions.
196 | - [FluentAssertions.Eventual](https://github.com/mazharenko/FluentAssertions.Eventual) -   - Generates a specialized waiting wrapper for `FluentAssertions` assertions, offering a syntax similar to plain `FluentAssertions`.
197 | - [ScenarioTests](https://github.com/koenbeuk/ScenarioTests) -  Test your code like you would write a notebook. Simply and effective
198 |
199 | #### Mocking
200 |
201 | - [GRPC-Mock-Server](https://github.com/cezarypiatek/GRPC-Mock-Server) -  - A source generator for stubbing GRPC services.
202 | - [InterfaceGenerator](https://github.com/daver32/InterfaceGenerator) -   - Auto generate interface definition by implementation, for when you need an abstraction for the sake of mocking.
203 | - [MockableStaticGenerator](https://github.com/HamedFathi/MockableStaticGenerator) -   A C# source generator to make an interface and a class wrapper to test static/extension methods.
204 | - [MockGen](https://github.com/thomas-girotto/MockGen) -   A C# mocking library based on source generators.
205 | - [MockSourceGenerator](https://github.com/hermanussen/MockSourceGenerator) -   A C# mocking library that generates mocks at compile-time using a source generator.
206 | - [ProxyInterfaceGenerator](https://github.com/StefH/ProxyInterfaceSourceGenerator) -  generate an interface and a Proxy class for classes. This makes it possible to wrap external classes which do not have an interface, in a Proxy class which makes it easier to Mock and use DI.
207 | - [Rocks](https://github.com/JasonBock/Rocks) -   A mocking library based on the Compiler APIs (Roslyn + Mocks).
208 |
209 | ### Patterns
210 |
211 | - [ActorSrcGen](https://github.com/aabs/ActorSrcGen) -   Generates boilerplate to turn simple C# classes into TPL Dataflow compatible pipelines with robust and performant asynchronous and concurrent code.
212 | - [Lombok.NET](https://github.com/CollinAlpert/Lombok.NET) -   Generates boilerplate code and common code patterns. As the name suggests, it is the .NET version of Java's Lombok.
213 | - [Minerals.AutoMixins](https://github.com/SzymonHalucha/Minerals.AutoMixins) -   Package for automatic mixin design pattern generation using an incremental source generator.
214 | - [Minerals.AutoCQRS](https://github.com/SzymonHalucha/Minerals.AutoCQRS) -   NuGet package that provides interfaces for implementing the CQRS pattern (Commands, Queries, and Pipelines) along with automatic dependency injection and no MediatR package overhead.
215 |
216 | #### Mediator
217 |
218 | - [DumplingsDevs.Pipelines](https://github.com/DumplingsDevs/Pipelines) -   The most flexible mediation implementation in the .NET ecosystem with your own types.
219 | - [Immediate.Handlers](https://github.com/immediateplatform/Immediate.Handlers) -  An implementation of the Mediator pattern in .NET using source generators, without using a central mediator instance.
220 | - [Mediator](https://github.com/martinothamar/Mediator) -  - a high performance implementation of Mediator pattern in .NET using source generators.
221 | - [MediatR controllers generator](https://github.com/Burgyn/MMLib.MediatR.Generators) -  This generator generates controllers and their methods based on your [MediatR](https://github.com/jbogard/MediatR) requests.
222 |
223 | #### Command
224 |
225 | - [Plastic](https://github.com/sang-hyeon/Plastic) -  This project provides encapsulation of things like Domain, Application Rules, Business Rules or Business Logic in Application.
226 |
227 | #### Builder
228 |
229 | - [Data Builder Generator](https://github.com/dasMulli/data-builder-generator) -  Generate data builder patterns for your model classes.
230 | - [FluentBuilder](https://github.com/StefH/FluentBuilder) -   - A project which uses Source Generation to create a FluentBuilder for a specified model or DTO.
231 | - [M31.FluentAPI](https://github.com/m31coding/M31.FluentAPI) -   - Generate fluent APIs for your C# classes with ease.
232 |
233 | #### Proxy
234 |
235 | - [avatar](https://github.com/kzu/avatar) -  A modern compile-time generated interception/proxy library.
236 | - [DudNet](https://github.com/jwshyns/DudNet) -   A C# source generator for implementing a proxy pattern.
237 |
238 | #### Visitor
239 |
240 | - [MrMeeseeks.Visitor](https://github.com/Yeah69/MrMeeseeks.Visitor) -   Generates the boilerplate code for applications of the Visitor pattern.
241 |
242 | #### Adapter
243 |
244 | - [AutoInterface](https://github.com/beakona/AutoInterface) -  interface-to-member source generator.
245 | - [Minerals.AutoInterfaces](https://github.com/SzymonHalucha/Minerals.AutoInterfaces) -   Package for automatic interface generation using an incremental source generator.
246 |
247 | #### Fluent API
248 | - [SuperFluid](https://github.com/hughesjs/SuperFluid) -   Generates the interfaces to represent a fluent API with grammar
249 |
250 | ### Domain Driven Design (DDD)
251 |
252 | - [AltaSoft.DomainPrimitives](https://github.com/altasoft/DomainPrimitives) -   - A C# toolkit purposefully designed to accelerate the development of domain-specific primitives within your applications. This streamlined solution empowers developers to efficiently encapsulate fundamental domain logic. Through this toolkit, you'll significantly reduce code complexity while improving the maintainability of your project.
253 | - [Architect.DomainModeling](https://github.com/TheArchitectDev/Architect.DomainModeling) -   A complete Domain-Driven Design (DDD) toolset for implementing domain models, including base types and source generators for ValueObjects, WrapperValueObjects, Entities, and Identities.
254 | - [Minerals.AutoDomain](https://github.com/SzymonHalucha/Minerals.AutoDomain) -   This package provides a fast method of defining domain layer components with their specific implementation, such as aggregates, entities and domain events. Package has built-in strongly typed IDs.
255 |
256 | ### Metaprogramming
257 |
258 | - [GenerateHelperLibraries](https://github.com/musictopia2/GenerateHelperLibraries) -   A source generator where you can send any code to the client without having to do as a string. Helper for custom classes a client has to override in order to have additional features for source generators. Intended to be used from another source generator.
259 | - [Gobie](https://github.com/GobieGenerator/Gobie) -  - Allows developers define and use custom source generation without writing any generator code themselves or learning the Roslyn APIs. Instead, devs define the generator they want, in C#, and can then use that generator throughout their project.
260 | - [Matryoshki](https://github.com/krasin-ga/matryoshki) -   Metaprogramming framework based on C# source generators. It allows you to define behaviours with adornments and generate decorators for arbitrary types.
261 | - [SourceGeneratorQuery](https://github.com/roeibajayo/SourceGeneratorQuery) -   - C# SourceGenerator helper which helps you query your files, and adds LINQ support.
262 |
263 | ### Webprogramming
264 |
265 | - [AjaxService.Gen](https://github.com/MrAliSalehi/AjaxService) -   - Automatically Generate typescript Ajax calls based on your C# Api endpoints.
266 | - [ApiClientGenerator](https://github.com/surgicalcoder/ApiClientGenerator) -   Generates a strongly typed HttpClient based off MVC's default routing. Can be used to output into multiple projects, like Blazor WebAssembly.
267 | - [ControllerGenerator](https://github.com/cloud0259/ControllerGenerator) -  Automatically generate controllers from services in a web application
268 | - [HttpClientCodeGenerator](https://github.com/Jalalx/HttpClientCodeGenerator) -  - HttpClientGenerator is a tool that uses the Roslyn code generator feature to write boilerplate HttpClient code for you.
269 | - [Immediate.Apis](https://github.com/immediateplatform/immediate.apis) -   - Generates minimal APIs bindings for [Immediate.Handlers](https://github.com/immediateplatform/immediate.handlers) handlers.
270 | - [Ridge](https://github.com/Melchy/Ridge) -  Generates strongly-typed clients for API based on controller definition and internal application details.
271 | - [Safe-Routing](https://github.com/daviddotcs/safe-routing) -  Analyses a project's razor pages and MVC controllers, producing strongly-typed representations of those routes as you type
272 | - [TypedSignalR.Client](https://github.com/nenoNaninu/TypedSignalR.Client) -  C# Source Generator to create strongly typed SignalR clients.
273 |
274 | #### Open Api
275 |
276 | - [H.NSwag.Generator](https://github.com/HavenDV/H.NSwag.Generator) -  - C# Source Generator for NSwag.
277 | - [SourceApi](https://github.com/alekshura/SourceApi) -   - API first Open API code generator based on json or yaml definitions. It generates base abstract controllers with docs, routes, that you inherit and implement in your controllers.
278 | - [ST.NSwag.ServerSourceGenerator](https://github.com/s-tarasov/ST.NSwag.ServerSourceGenerator) -  Generates Web API/ASP.NET Core controllers from a OpenAPI specification.
279 |
280 | #### Razor / Blazor
281 |
282 | - [BlazorInteropGenerator](https://github.com/surgicalcoder/BlazorInteropGenerator) -  Generates Blazor -> Javascript strongly typed interop methods, by parsing the Javascript it self and generating extension methods for IJSRuntime.
283 | - [BlazorOcticons](https://github.com/BlazorOcticons/BlazorOcticons) -   Github [Octicons](https://primer.style/octicons/) created as a `.razor` components using source generator. The generated components are available via the NuGet package, the generator itself is available as a separate NuGet package. The project [website](https://blazorocticons.net/) is an example using the generated components.
284 | - [MiniRazor](https://github.com/Tyrrrz/MiniRazor) -  Portable Razor compiler & code generator.
285 | - [RazorPageRouteGenerator](https://github.com/surgicalcoder/RazorPageRouteGenerator) -   Generates methods with parameters for Razor and Blazor pages, so you can navigate without having to guess URLs or parameters.
286 |
287 | ### XAML / WPF / Avalonia
288 |
289 | - [Avalonia.NameGenerator](https://github.com/AvaloniaUI/Avalonia.NameGenerator) -  Generates typed references to named [Avalonia](https://github.com/avaloniaui) XAML controls.
290 | - [boilerplatezero](https://github.com/IGood/boilerplatezero) -  WPF Dependency Property and Routed Event generator.
291 | - [DependencyPropertyGenerator](https://github.com/HavenDV/DependencyPropertyGenerator) -   Dependency property and routed event source generator for WPF/UWP/WinUI/Uno/Avalonia/MAUI platforms.
292 | - [WinUI-ObservableSettings](https://github.com/JasonWei512/WinUI-ObservableSettings) -  - Generate boilerplates to read and write settings in packaged WinUI 3 app.
293 |
294 | #### INotifyPropertyChanged
295 |
296 | - [PropertyChanged.SourceGenerator](https://github.com/canton7/PropertyChanged.SourceGenerator) -  - Powerful INotifyPropertyChanged Source Generator, which generates INPC boilerplate for you as part of your build. Supports features such as automatic and manual dependencies between properties, notifications when specific properties change, and more.
297 | - [ValueChangedGenerator](https://github.com/ufcpp/ValueChangedGenerator) -  for generating PropertyChanged from inner struct members.
298 |
299 | #### Model View Viewmodel (MVVM)
300 |
301 | - [DevExpress.Mvvm.CodeGenerators](https://github.com/DevExpress/DevExpress.Mvvm.CodeGenerators) -   Generates boilerplate code for your View Models (INotifyPropertyChanged, Commands, IDataErrorInfo, DevExpress services). Compatible with the Prism and MVVM Light libraries.
302 | - [Microsoft MVVM Toolkit](https://github.com/CommunityToolkit/dotnet) -  A modular MVVM library with support for source generators to reduce boilrplate and improve performance.
303 | - [MvvmGen](https://github.com/thomasclaudiushuber/mvvmgen) -   A lightweight MVVM library for XAML applications that generates your ViewModels with a C# Source Generator.
304 |
305 | ### Database / ORM
306 |
307 | - [AdaskoTheBeAsT.Identity.Dapper](https://github.com/AdaskoTheBeAsT/AdaskoTheBeAsT.Identity.Dapper) -   - Custom Dapper implementation for Microsoft.Extensions.Identity.Stores (part of ASP.NET Core Identity)
308 | - [Breezy](https://github.com/Ludovicdln/Breezy) -   Micro ORM with source generator.
309 | - [Dynatello](https://github.com/inputfalken/Dynatello) -   A source generator for the low-level API of DynamoDB.
310 | - [MapDataReader](https://github.com/jitbit/MapDataReader) -   - Fast mapping `IDataReader` to a custom class
311 | - [SqlMarshal](https://github.com/kant2002/SqlMarshal) -  Native AOT friendly-performant mini-ORM. Generation of wrappers for accessing SQL using ADO.NET.
312 | - [TableStorage](https://github.com/StevenThuriot/TableStorage) -   Streamlined way of working with Azure Data Tables that mimics Entity Framework's way of working with DbSets. Source Generators for the Table Entities to avoid any reflection calls being made, making it easier to use Azure Data Tables in a NativeAOT project.
313 | - [EntityLengths.Generator](https://github.com/TarasKovalenko/EntityLengths.Generator) -   Source Generator designed to automatically generate string length constants from Entity Framework configurations and data annotations.
314 |
315 | ### Statically typed resources / configurations
316 |
317 | - [dot-env-generator](https://github.com/RainwayApp/dot-env-generator) -   A source generator for C# that turns `.env` files into runtime constants.
318 | - [EnvVariablesGenerator](https://github.com/KAW0/EnvVariablesGenerator) -   Generate code from `.env` files that can be changed after build.
319 | - [NotNot.AppSettings](https://github.com/jasonswearingen/NotNot.AppSettings) -   Automatically create strongly typed C# settings objects from AppSettings.json.
320 | - [SourceConfig](https://github.com/alekshura/SourceConfig) -   - Generates configuration POCO objects, lists, dictionaries in AOT based on *.json config files.
321 | - [StronglyTypedEmbeddedResources](https://github.com/surgicalcoder/StronglyTypedEmbeddedResources) -   Generates strongly typed names for Embedded Resources automatically.
322 | - [TxtToListGenerator](https://github.com/musictopia2/TxtToListGenerator) -   A source generator where if you have a text file as additional file and you have a list ordered by return carriages, then it produces either a list of int or a list of string in c#.
323 |
324 | ### Text templating
325 |
326 | - [Transplator](https://github.com/atifaziz/Transplator) -   A simple C# source generator for text templates.
327 | - [Weave](https://github.com/otac0n/Weave) -   Weave is a text templating engine for .NET that is all about attention to detail. Weave handles the tricky work of making your rendered text beautiful.
328 | - [TemplatePropertyGenerator](https://github.com/JKamsker/JKToolKit.TemplatePropertyGenerator) -   Generates strongly typed stringformatters based on Stringformats
329 |
330 | ### Other
331 |
332 | - [AutoConstructor](https://github.com/k94ll13nn3/AutoConstructor) -   C# source generator that generates a constructor from readonly fields/properties in a class or struct.
333 | - [AutoFilterer.Generators](https://github.com/enisn/AutoFilterer/blob/develop/docs/generators/AutoFilterer-Generators.md) -   AutoFilterer.Generators aims to generate filter DTOs from entities automatically via using dotnet source generators.
334 | - [AutomaticInterface](https://github.com/codecentric/net_automatic_interface) -   Generate an Interface from a class.
335 | - [AutoInvoke](https://github.com/LokiMidgard/AutoInvoke.Generator) -  A generator that generates a method that invokes a specified generic method, for every Type in your project that satisfies a defined constraint.
336 | - [BigMachines](https://github.com/archi-Doc/BigMachines) -  BigMachines is State Machine library for .NET.
337 | - [BitsKit](https://github.com/barncastle/BitsKit) - A C# library for efficient bit-level reading and writing also adding bit field support
338 | - [BuildInformationGenerator](https://github.com/pekspro/BuildInformationGenerator) -  Adds build information, like build time, commit it and branch, as simple constants.
339 | - [CacheSourceGenerator](https://github.com/jeppevammenkristensen/cachesourcegenerator) -  Generates an IMemoryCache wrapper around a method call.
340 | - [Cloneable](https://github.com/mostmand/Cloneable) -   auto-generate Clone method.
341 | - [Credfeto.Version.Information.Generator](https://github.com/credfeto/credfeto-version-constants-generator) -   Minimal source generator for embedding build information as compile time constants. Constants added to `VersionInformation` class in each assembly for `Version`, `Product`, `Company` and `Copyright`.
342 | - [CsCodeGenerator](https://github.com/borisdj/CsCodeGenerator) -   Easy C# class and code generation, POCO object and Methods creation.
343 | - [Dolly](https://github.com/AnderssonPeter/Dolly) -   auto-generate Clone & DeepClone method.
344 | - [Durian](https://github.com/piotrstenke/Durian) -   Extends the default capabilities of C# by mimicking features from other languages.
345 | - [Fairy](https://github.com/hermanussen/Fairy) -  generates C# code based on Sitecore Content Serialization (SCS) `.yml` files.
346 | - [FastGenericNew](https://github.com/Nyrest/FastGenericNew) -   The ultimate fast alternative to `Activator.CreateInstance` / `new T()`. Built on SourceGenerator V2 (Incremental Generator).
347 | - [GitBuildInfo.SourceGenerator](https://github.com/Elskom/GitBuildInfo.SourceGenerator) -  - for dumping the git information (commit hash, branch, the head description) into assembly level metadata attributes.
348 | - [Hangfire.RecurringJob](https://github.com/IeuanWalker/Hangfire.RecurringJob) -   - Automatically generates the recurring job registration code.
349 | - [IDisposableGenerator](https://github.com/Elskom/IDisposableGenerator) -  - a Source Generator for Generating the Dispose functions in Disposables. All you have to do is mark them with attributes and it will work from there.
350 | - [Lazysh](https://github.com/B1Z0N/LazyshGen) -   Lazy implementation of any interface.
351 | - [LinqGen](https://github.com/cathei/LinqGen) -   Alloc-free and fast replacement for Linq, with code generation.
352 | - [LoggingDecoratorGenerator](https://github.com/DavidFineboym/LoggingDecoratorGenerator) -   Generates logger decorator class for an interface. Uses Microsoft.Extensions.Logging.ILogger to log and requires it in decorator class constructor.
353 | - [MemberAccessGenerator](https://github.com/ufcpp/MemberAccessGenerator) -  generates `GetMember(int)` and/or `GetMember(string)` methods that return property value for a given property name or index (e.g. in positional records).
354 | - [MrMeeseeks.StaticDelegateGenerator](https://github.com/Yeah69/MrMeeseeks.StaticDelegateGenerator) -   Makes static classes and members injectable as dependency by generating delegating interfaces and their implementing classes.
355 | - [Navitski.Crystalized](https://github.com/AlexNav73/Navitski.Crystalized) -   Generates domain model based on schema files. Generated model supports undo/redo, saving to/loading from SQLite and Json files, precise changes tracking and more.
356 | - [net_automatic_interface](https://github.com/codecentric/net_automatic_interface) -  .Net Core Source Generator for Automatic Interfaces.
357 | - [PolySharp](https://github.com/Sergio0694/PolySharp) -  Provides generated, source-only polyfills for C# language features, to easily use all runtime-agnostic features downlevel.
358 | - [PrimaryConstructor](https://github.com/chaowlert/PrimaryConstructor) -  Generate primary constructor from readonly fields.
359 | - [PrimitiveStaticDataGenerator](https://github.com/iiweis/PrimitiveStaticDataGenerator) -  for creating methods that return optimized `ReadOnlySpan` static data from primitive values.
360 | - [PrintMembersGenerator](https://github.com/Youssef1313/PrintMembersGenerator) -  helps re-defining C# record's PrintMembers method to force include/exclude certain members.
361 | - [QuickConstructor](https://github.com/flavien/QuickConstructor) -   A reliable and feature-rich source generator that can automatically emit a constructor from the fields and properties of a class. It can also generate null checks based on nullable reference types annotations.
362 | - [SmallSharp](https://github.com/kzu/SmallSharp) -  Create, edit and run multiple C# 9.0 top-level programs in the same project by just selecting the startup program from the start button.
363 | - [SmartAnnotations](https://github.com/fiseni/SmartAnnotations) -  A library that uses source generators to automatically generate data annotations for your models. It provides a strongly-typed mechanism (fluent like API) to define your annotation rules.
364 | - [StringLiteralGenerator](https://github.com/ufcpp/StringLiteralGenerator) -  for optimizing UTF-8 binaries.
365 | - [SyncMethodGenerator](https://github.com/zompinc/sync-method-generator) -  - Generates a synchronized method from your async code.
366 | - [ThisAssembly](https://github.com/kzu/ThisAssembly) -  Exposes project and assembly level information as constants in the ThisAssembly class.
367 | - [ToString](https://github.com/Burgyn/MMLib.ToString) -  - C# source generator for implementing `ToString` override like `record` type.
368 | - [TupleOverloadGenerator](https://github.com/ProphetLamb/TupleOverloadGenerator) -   - Overload `params` array parameter with tuples avoiding heap allocations.
369 | - [ValueLink](https://github.com/archi-Doc/ValueLink) -  A C# Library for creating and managing multiple links between objects.
370 | - [AutoLoggerMessage](https://github.com/stbychkov/AutoLoggerMessage) -   Automatically migrates your logging calls to the LoggerMessage (high-performance logging) version
371 |
372 | ## Meta - libs and generators for other generators
373 |
374 |
378 |
379 | - [AttributeFactoryGenerator](https://github.com/PaulBraetz/AttributeFactoryGenerator) -   - Generate factories to easily parse actual attribute instances from symbol data.
380 | - [AttributesSourceGeneratorHelper](https://github.com/musictopia2/AttributesSourceGeneratorHelper) -   A source generator to help another generator by producing attributes. Anything that inherits from Attribute will be sent to the client so you don't have to build strings for attributes.
381 | - [CommonSourceGeneratorsHelpers](https://github.com/musictopia2/CommonSourceGeneratorsHelpers) -   A generator to create many helpers for source generators to use to make up that its very difficult to reference third party libraries in source generators including extensions and a source code string builder.
382 | - [HotReload](https://github.com/andrzejolszak/BuilderGeneratorHotReload) -   - A simple hack to enable hot reload in Visual Studio Intellisense when developing a source generator project together with an example dependent client project inside a single solution.
383 | - [SourceGeneratorUtils](https://github.com/thenameless314159/SourceGeneratorUtils) -   An essential library equipped with utility functions and helpers to aid in writing source files for source generators or for general purposes. Based on the `System.Text.Json` source generator architecture for best-practices.
384 | - [SourceGenerator.Helper.CopyCode](https://github.com/LokiMidgard/SourceGenerator.Helper.CopyCode) -   - A simple Generator that generates a string representation to an annotated Type.
385 |
386 | ## Tips & Tricks
387 |
388 | Collection of tips and tricks (simple and brief to fit in Tweet):
389 |
390 | [Tweeted](https://twitter.com/raboof/status/1397296571801288704) by [@raboof](https://twitter.com/raboof) on May 25 2021 at 23:00:
391 |
392 | > TIL to debug a source generator in VS 16.10: upgrade [Microsoft.CodeAnalysis.CSharp to 3.10.\*](https://www.nuget.org/packages/Microsoft.CodeAnalysis.CSharp/3.10.0-3.final), add `true` to source generator project, select **Roslyn Component** for **Launch** in **Project Properties Debug** page, choose **Target** then F5 :rocket:
393 | >
394 | > 
395 |
396 | [Tweeted](https://twitter.com/raboof/status/1328426892882550784) by [@raboof](https://twitter.com/raboof) on Nov 16 2020 at 20:57:
397 |
398 | > See files emitted by [#SourceGenerators] by adding these properties to your (*.csproj) project file:
399 | >
400 | > ```xml
401 | > true
402 | > $(BaseIntermediateOutputPath)Generated
403 | > ```
404 |
405 | [Tweeted](https://twitter.com/Chiser99/status/1301198611158499328) by [@Chiser99](https://twitter.com/Chiser99) on Sep 02 2020 at 06:41:
406 |
407 | > I made a thing: https://github.com/chsienki/Kittitas
408 | >
409 | > If you're building Roslyn Source Generators or Analyzers check it out, it makes debugging them inside the compiler easier. #roslyn #csharp #dotnetcore #sourcegenerators #analyzers
410 |
411 | Build failed in WPF projects [microsoft/CsWin32#7](https://github.com/microsoft/CsWin32/issues/7):
412 |
413 | > If your build failed in a *_wpftmp.csproj file you need to add following property to your (*.csproj) project file:
414 | > ```xml
415 | > true
416 | > ```
417 | >
418 | > and use at least .NET 5.0.102 SDK
419 |
420 | [#SourceGenerators]: https://twitter.com/hashtag/SourceGenerators?src=hashtag_click
421 | [#sourcegenerators]: https://twitter.com/hashtag/sourcegenerators?src=hashtag_click
422 | [#roslyn]: https://twitter.com/hashtag/roslyn?src=hashtag_click
423 | [#csharp]: https://twitter.com/hashtag/csharp?src=hashtag_click
424 | [#dotnetcore]: https://twitter.com/hashtag/dotnetcore?src=hashtag_click
425 | [#analyzers]: https://twitter.com/hashtag/analyzers?src=hashtag_click
426 |
427 | Reference local projects or embed NuGet packages to source generator assemblies [dotnet/roslyn#47517](https://github.com/dotnet/roslyn/discussions/47517#discussioncomment-64145):
428 |
429 | ⚠ Please be aware that this may result in crashes, when another generator or SDK component loads such an assembly with lower version. If you can, please avoid embedding additional DLLs/packages.
430 |
431 | > You can add a dependency to a source generator in the same solution through three steps:
432 | >
433 | > 1. Add a ``, making sure to set both `GeneratePathProperty="true"` and `PrivateAssets="all"`
434 | > 2. Add a build target to add `` elements as part of GetTargetPath, and add all the required dependency assemblies inside this target, making sure to set `IncludeRuntimeDependency="false"`
435 | > 3. Update `` to ensure the target from the previous step is used
436 | >
437 | > You can see an example of these steps here:
438 | > https://github.com/dotnet/roslyn-sdk/blob/0313c80ed950ac4f4eef11bb2e1c6d1009b328c4/samples/CSharp/SourceGenerators/SourceGeneratorSamples/SourceGeneratorSamples.csproj#L13-L30
439 |
440 | ## Articles
441 |
442 |
446 | - [Series: Creating a source generator](https://andrewlock.net/series/creating-a-source-generator/) (2022-02-01) Complete series about how to create an incremental source generator, using the APIs introduced in .NET 6.
447 | - [Mastering at Source Generators](https://medium.com/c-sharp-progarmming/mastering-at-source-generators-18125a5f3fca) (2022-01-15) Generating CRUD controller from DTO model using text template.
448 | - [Using C# Source Generators to create an external DSL](https://devblogs.microsoft.com/dotnet/using-c-source-generators-to-create-an-external-dsl/) (2021-01-27) that shows how to implement a simple DSL.
449 | - [4 ways to generate code in C# — Including Source Generators in .NET 5](https://levelup.gitconnected.com/four-ways-to-generate-code-in-c-including-source-generators-in-net-5-9e6817db425) (2021-01-19) demonstrates the comparison between Source Generators, T4 template and Reflection, etc.
450 | - [.NET 5 Source Generators - MediatR - CQRS - OMG!](https://www.edument.se/en/blog/post/net-5-source-generators-mediatr-cqrs) (2020-12-16) explores how source generators can be used to automatically generate an API for a system using the MediatR library and the CQRS pattern.
451 | - [Source Generators in .NET 5 with ReSharper](https://blog.jetbrains.com/dotnet/2020/11/12/source-generators-in-net-5-with-resharper/) (2020-11-20) introduces source generators and briefly mentions how they are being worked into the ReSharper product.
452 | - [Source Generators - real world example](https://dominikjeske.github.io/source-generators) (2020-11-09) contains a rich and deep dive into a real world generator with lots of useful tips.
453 | - [How to profile C# 9.0 Source Generators](https://jaylee.org/archive/2020/10/10/profiling-csharp-9-source-generators.html) (2020-10-10) demonstrates how to profile your source generator using the [performance profiling tools built into Visual Studio](https://docs.microsoft.com/en-us/visualstudio/profiling/?view=vs-2019).
454 | - [How to Debug C# 9 Source Code Generators](https://nicksnettravels.builttoroam.com/debug-code-gen/) (2020-10-09) contains debugging tips.
455 | - [How to generate code using Roslyn source generators in real world scenarios](https://www.cazzulino.com/source-generators.html) (2020-09-17) rich story of how ThisAssembly generator was written using Scriban templates.
456 | - [.NET Blog 'New C# Source Generator Samples' post](https://devblogs.microsoft.com/dotnet/new-c-source-generator-samples/) (2020-08-25) that shows some simple samples.
457 | - [.NET Blog 'Introducing C# Source Generators' post](https://devblogs.microsoft.com/dotnet/introducing-c-source-generators/) (2020-04-29) that announces the feature.
458 |
459 | ## Videos
460 |
461 |
465 |
466 | - [C# Source Generators - Write code that writes code - David Wengier](https://www.youtube.com/watch?v=pqLs7X6Cr6s) (2020-11-13) Roslyn dev takes deep dive into the topic.
467 | - [.NET Languages and Runtime Community Standup - Source Generators](https://www.youtube.com/watch?v=A4479Etdx4I) (2020-10-08) shows how Generators work and how they can be tested.
468 | - [Channel 9 'Source Generators in C#'](https://channel9.msdn.com/Shows/Visual-Studio-Toolbox/Source-Generators-in-CSharp) (2020-08-12) has Roslyn PMs discussing the feature.
469 |
470 | ## Demo, PoC and excercise projects
471 |
472 | Maybe they can inspire you too!
473 |
474 | - [RyanAlameddine/SourceGeneratorDemo](https://github.com/RyanAlameddine/SourceGeneratorDemo) -   contains 3 demos: hello world, INPC and OpCode class.
475 | - [TMC-CSharp/CodeExerciseLibrary](https://github.com/TMC-CSharp/CodeExerciseLibrary) -   Library to help creating C# exercises. Generates missing methods and classes inside tests on the fly by using Source Generators.
476 | - [DpdtInject](https://github.com/lsoft/DpdtInject) -   DI container based on C# Source Generators. Its goal is to remove everything possible from runtime and make resolving process as faster as we can. This is achieved by transferring huge piece of resolving logic to the compilation stage into the source generator.
477 | - [jakubsturc/talk-csharp-source-generators](https://github.com/jakubsturc/talk-csharp-source-generators/tree/master/demo/SourceGeneratorSamples) -   contains 4 generators: AutoNotify, ConsoleWritelineHijack, HelloWorld and SettingsXml, plus nice presentation slides.
478 | - [Compile Time Method Execution Generator](https://github.com/hermanussen/CompileTimeMethodExecutionGenerator) -   proof of concept that allows executing a method during compilation, so that it can be really fast during runtime.
479 |
480 | ## Projects using custom Source Generators "internally"
481 |
482 | - [Elskom/Sdk](https://github.com/Elskom/Sdk) -   Dumps git repository data to assembly level metadata attributes that can be checked at runtime for things like trapping if a user is using an possibly unstable build of the libraries built in the repository and so the user can see a message about it (and optionally opt into running the possibly unstable code).
483 | - [Heroicons.AspNetCore](https://github.com/tompazourek/Heroicons.AspNetCore) -  [Heroicons](https://heroicons.com/) that are easy to use in ASP.NET Core MVC as TagHelpers.
484 | - [NetFabric.Hyperlinq](https://github.com/NetFabric/NetFabric.Hyperlinq) -   generates overloads for its extension methods.
485 | - [RestEase](https://github.com/canton7/RestEase) -   uses Source Generator to generate interface implementations on compile time instead of in runtime via Reflection.Emit.
486 | - [WarHub/wham](https://github.com/WarHub/wham) -   generates code for immutable tree object graph based on red-green node approach used in Roslyn; generates custom XmlSerializer that supports C#9 records and ImmutableArray.
487 |
--------------------------------------------------------------------------------