Warning CS0436 : The type GenerateOneOfAttribute conflicts with imported type...
I have one project (library) where I'm using OneOf/Source generators. I build a nuget of that library and I'm using that nuget in another library, where I'm also using OneOf/Source generators.
When I build the second library, I'm getting the following warning message: Warning CS0436 : The type 'GenerateOneOfAttribute' in 'OneOf.SourceGenerator\OneOf.SourceGenerator.OneOfGenerator\GenerateOneOfAttribute.g.cs' conflicts with the imported type 'GenerateOneOfAttribute' in 'XXXX.ValueObjects, Version=23.11.10.2317, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'OneOf.SourceGenerator\OneOf.SourceGenerator.OneOfGenerator\GenerateOneOfAttribute.g.cs'..
Probably means nothing, but if there is a way for this warning to not appear, it would be helpful.
Thanks in advance and regards,
Do you use InternalsVisibleTo from one library to the other? Because the GenerateOneOfAttribute is generated as internal and I can't see how this would lead to a conflict without using InternalsVisibleTo.
You can fix this issue at the Source Generator level by packing the attributes as an actual assembly into the source generator package but putting it into the net2.0 folder instead of the analyzers. Many source generators do this nowadays.