This project primarily serves to demonstrate automatic packing of dependencies into the analyzer folder for a standalone source generator (i.e. not attached to a library).
SourceGenerationManagedReferences is the source generator project, the primary subject of this repository. Any dependencies that aren't available to analyzers, such as System.Text.Json, are declared in another project named SourceGenerationManagedReferences.Dependencies. Dependencies are declared this way to leverage much of the existing infrastructure handling the dependency graph and to isolate dependencies that are available to source generators, such as Microsoft.CodeAnalysis, from those that aren't. Admittedly, this approach leads to a longer and less self-explanatory configuration, therefore, parts of this project might be better packaged as a build tool.
Two sample projects are provided referencing the source generator project in the samples folder. Please run the packnpushlocal.sh bash script before trying to build them. The bash script essentially builds and packs the SourceGenerationManagedReferences project and pushes the resulting package into the top-level packages folder, which is declared a NuGet source through the project-local nuget.config.