Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning CS0436 : The type GenerateOneOfAttribute conflicts with imported type... #168

Open
CheloXL opened this issue Nov 11, 2023 · 2 comments

Comments

@CheloXL
Copy link

CheloXL commented Nov 11, 2023

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,

@cremor
Copy link

cremor commented May 8, 2024

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.

@Blackclaws
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants