Hi,
[SOLVED]
looks like I am the only one with this “misbehaviour”…
I just started a new Unity project to refactor the old one in some sense. But now it keeps complaining about almost everything … it issues a warning “not CLS-compliant” for any struct type imported from UnityEngine, like Vector3…
regards
chris
In case someone else has this problem… I included some new third party code (PowerCollections) which had an “assembly CLS compliant” Attribute somewhere… So if anyone else has this issue, that’s most likely the way you get it. Didn’t think about that you can enable this in C# from within code.
3 Likes
Solve my warning , thank you.
Had the same issue, you save me a lot of time, cheers.
I know the problem from working with third party assemblies in desktop applications. CLS complience means, that the assembly can be used from any .NET language.
Example: C# is case sensitive on member names, visual basic is not.
If you want your assembly to be maximally compatible for a release via nuget for example, you should make sure it’s CLS-compliant.
The attribute [assembly: CLSCompliant(true)] which is often found in the assembly.cs file tells your compiler if it is supposed to complain when you break cls-compliancy. If you use other assemblies, that themselves are not cls-compliant ( for example the unity assemblies ), you dont need to be cls-compliant yourself, so just set the attribute to
[assembly: CLSCompliant(false)] and everythings fine.
1 Like