NServiceBus
NServiceBus copied to clipboard
Provide SourceGenerator as well as the new Incremental Source Generator for better performance
The incremental source generators allow optimizing the code generation strategies for faster execution, which greatly benefits the overall IDE experience. It is possible to share common code between both approaches and then package the source generator for Roslyn3.x for backward compatibility and the incremental source generator for Roslyn4 together into the same package.

How that is done can be seen in
https://github.com/dotnet/runtime/tree/main/src/libraries/System.Text.Json/gen
The other trick to make it work for older versions that don't support "Roslyn Component Versioning" is the targets file they include in the package's build folder
See also https://github.com/dotnet/sdk/issues/20355