SDKs released before .NET 6 don't select the specific version of roslyn from the nuget, and instead run all of them.
This leads to the generator running multiple times, leading to a compile error.
https://andrewlock.net/supporting-multiple-sdk-versions-in-analyzers-and-source-generators/#supporting-multiple-sdk-versions-and-lighting-up-features
To fix - add some build transitive targets