COBCH1704 CLSCompliant(true) not allowed for <member> as assembly does not have CLSCompliant attribute

The attribute CLSCompliant(true) is not set for the containing assembly, and therefore this element (and other elements in the assembly) cannot claim to be CLS compliant.

Set the CLSCompliant(true) attribute in the assembly-attributes paragraph, or remove the attribute from the assembly member.

class-id myClass.
assembly-attributes.             *> add these two lines
 attribute CLSCompliant(true).   *> to enable the other CLSCompliant attribs

01 myfield1 binary-long signed attribute CLSCompliant(true). *> or remove this attribute

method-id myMethod attribute CLSCompliant(true). *> and remove this attribute
...
end method.
end class.

The rules for setting the CLSCompliant attribute:

  • Setting the attribute at the assembly level assumes that all members within it are CLS compliant, and the Compiler issues warnings where that is not the case.
  • When the attribute is set at the assembly level, set the attribute CLSCompliant(false) on individual members to suppress the warnings.
  • When the attribute is set on a method or field, it must also be set on the containing class or assembly.
  • When the attribute is set on a class, it must also be set on the containing assembly.