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?
Being CLS compliant means that you can write code that can be consumed by any language that can be compiled and run on the CLR. But CLS compliance is not required, giving you the flexibility in cases where CLS compliance would be hard or impossible to do.
To correct this error If the Function procedure must be CLS-compliant, change the return type to the closest CLS-compliant type. For example, in place of UInteger you might be able to use Integer if you do not need the value range above 2,147,483,647.
Remarks. The CLSCompliantAttribute attribute is used to indicate whether a particular program element complies with the Common Language Specification (CLS), which defines the features that any language that targets . NET must support.
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With