Reference Reference Number Not CLS Compliant

I have a .NET 3.5 C # project that has a namespace SampleNamespace.Tools.Sample.

If I add an assembly called "Samplenamespace.Utils.Example" to my project, I get the following warning:

Samplenamespace identifier that differs only in that it does not match the CLS

Note the lowercase "n" in Samplenamespace.

At the moment, I do not even use the link in my project. Just adding it as a link will give you a warning.

Why does the compiler complain about this, given that I don’t even show assembly links in my public classes?

Any workaround?

+5
source share
2 answers

Not all .NET languages ​​are case sensitive (for example, VB), when you have mixed namespaces like this, differing only in the case (to use the warning wording), your code may not be available to other developers.

This may not be your business, so this is a warning (which we see as an error in my store)

+7
source

This just warns you, since not all languages ​​that can consume types within your solution will be aware of the difference (and may not be able to use types).

I think you can avoid this warning by marking your assembly as CLS compatible (in the AssemblyInfo.cs file) ( read more here ):

[assembly:CLSCompliant(false)]

, , , ...

: , , , , , . , , , .

+3

All Articles