'Pack C# SourceGenerator with regular code in same nuget package
I create source generator that search for particular attribute in a partial class and extend it with methods and fields. Then this generator is packed into nuget using Package project type. This part works fine.
But
I also want this attribute to be distributed in a same nuget package, and I cant figure out how to do this.
I tried multiple variants and in all cases I can see the following picture in MSVS project explorer:

GodotFieldsGenerator is the generator package that also contains attribute, but in Packages section it is not expandable which means there is no dlls and classes there. At the same time generator cant generate anything as the attribute is not found.
I tried:
- put attribute class in a same dll where generator is located
- put it into separate dll and put both dlls into the package to 'analyzers/dotnet/cs' folder
- put it into separate dll and put attribute dll to 'lib/netstandard2.0' folder
Latest one can be found in https://github.com/ApmeM/GodotFieldsGenerator . There is also a nuget package 1.0.0.8 generated (the one that is on a screnshoot above).
How can I put both attribute and generator in a same nuget package? What am I doing wrong?
Thanks.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
