Reference Name case is not CLS Compliant

user115909 picture user115909 · Jun 2, 2009 · Viewed 8k times · Source

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

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

Identifier 'Samplenamespace' differing only in case is not CLS-compliant

Note the lower case 'n' in Samplenamespace.

I'm not even using the reference assembly in my project at the moment. Simply adding it as a reference causes the warning.

Why is the compiler complaining about this considering I'm not even exposing any references to the assembly in my public classes?

Any workaround?

Answer

Ralph Shillington picture Ralph Shillington · Jun 2, 2009

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

That may not be your case, which is why it's a warning (which in my shop we treat as an error)