Why is the C # compiler generating CS0436 warnings for inner classes?

I am using JetBrains annotations in a C # solution. I have brought the annotation classes into each solution project as a linked file. I didn't want JetBrains annotations to be part of my public interface, so I changed them to be internal and not public.

However, when I compile, I get a lot of CS0436 warnings like:

C: \ src \ foo \ bar.cs (12,29): warning CS0436: type 'JetBrains.Annotations.NotNullAttribute' in 'C: \ src \ Common \ JetBrains \ JetBrains.cs' conflicts with imported type' JetBrains.Annotations .NotNullAttribute 'to' c: \ src \ blah \ bin \ Debug \ blah.dll '. Using the type defined in 'C: \ src \ Common \ JetBrains \ JetBrains.cs'.

But in JetBrains.cs NotNullAttribute is internal:

internal sealed class NotNullAttribute : Attribute { }

      

I don't understand why the compiler is warning about importing types that are internal to another assembly. Any ideas?

+3


source to share


2 answers


Found the problem. The blah.dll node I mentioned had this in AssemblyInfo.cs:

[assembly: InternalsVisibleTo("my.other.assembly")]

      



Thanks for the input everyone.

+2


source


I had the same problem because there was a link to the same project in the Links folder. i.e .: my project name was Store and the link had the same name. I removed it and the problem is solved! good luck



+5


source







All Articles