6 Apr 2010

CLS-Compliancy classes in the SharePoint SDK

Posted by Alexander

Some classes in the SharePoint SDK are declared with [CLSCompliant(false)] to mark such a class as a non CLS-Compliant class. These classes or its derivation type could not be interoperable in a certain range of .NET supported programming languages. Your standard C# compiler will not check this by default.

If you got for example the following error:

Microsoft.SharePoint.SPFeatureReceiver is not CLS-compliant

it seems that you are using the non CLS-Compliant class Microsoft.SharePoint.SPFeatureReceiver. If you know that in your situation this is allowed you need to change the setting in your AssemblyInfo.cs file inside your project. You will find there a setting [assembly: CLSCompliant(true)] which should be set to “false”.

Leave a Reply

Message: