Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2008
Development Edition
Design Warnings
 Mark assemblies with CLSCompliantAt...

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
Visual Studio Team System
Mark assemblies with CLSCompliantAttribute

TypeName

MarkAssembliesWithClsCompliant

CheckId

CA1014

Category

Microsoft.Design

Breaking Change

Non Breaking

An assembly does not have the System..::.CLSCompliantAttribute attribute applied to it.

The Common Language Specification (CLS) defines naming restrictions, data types, and rules to which assemblies must conform if they are to be used across programming languages. Good design dictates that all assemblies explicitly indicate CLS compliance with CLSCompliantAttribute. If the attribute is not present on an assembly, the assembly is not compliant.

It is possible for a CLS-compliant assembly to contain types or type members that are not compliant.

To fix a violation of this rule, add the attribute to the assembly. Instead of marking the entire assembly as noncompliant, you should determine which type or type members are not compliant, and mark these elements as such. If possible, you should provide a CLS-compliant alternative for noncompliant members so that the widest possible audience can access all the functionality of your assembly.

Do not suppress a warning from this rule. If you do not want the assembly to be compliant, apply the attribute and set its value to false.

The following example shows an assembly with the System..::.CLSCompliantAttribute attribute applied that declares it CLS-compliant.

Visual Basic
Imports System

<assembly:CLSCompliant(true)>
Namespace DesignLibrary
End Namespace

C#
using System;

[assembly:CLSCompliant(true)]
namespace DesignLibrary {}

Visual C++
using namespace System;

[assembly:CLSCompliant(true)];
namespace DesignLibrary {}

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker