Export (0) Print
Expand All
Expand Minimize

Compiler Warning (level 1) CS3017

You cannot specify the CLSCompliant attribute on a module that differs from the CLSCompliant attribute on the assembly

This warning occurs if you have a assembly CLSCompliant attribute that conflicts with a module CLSCompliant attribute. An assembly that is CLS compliant cannot contain modules that are not CLS compliant. To resolve this warning, make sure the assembly and module CLSCompliant attributes are either both true or both false, or remove one of the attributes. For more information on CLS Compliance, see Writing CLS-Compliant Code and Common Language Specification.

The following example generates CS3017:

// CS3017.cs
// compile with: /target:module

using System;

[module: CLSCompliant(true)]
[assembly: CLSCompliant(false)]  // CS3017
// Try this line instead:
// [assembly: CLSCompliant(true)]
class C
{
    static void Main() {}
}

Community Additions

ADD
Show:
© 2014 Microsoft