Sdílet prostřednictvím


Compilerwarnung (Stufe 1) CS3012

Aktualisiert: November 2007

Fehlermeldung

Das CLSCompliant-Attribut kann nicht für ein Modul angegeben werden, das sich vom CLSCompliant-Attribut der Assembly unterscheidet.
You cannot specify the CLSCompliant attribute on a module that differs from the CLSCompliant attribute on the assembly

Damit ein Modul mit der Common Language Specification (CLS) kompatibel ist (über [module:System.CLCSompliant(true)]), muss es mit der Compileroption /target:module erstellt werden. Weitere Informationen zur CLS-Kompatibilität finden Sie unter CLS (Common Language Specification).

Beispiel

Im folgenden Beispiel wird beim Erstellen ohne /target:module der Fehler CS3012 generiert:

// CS3012.cs
// compile with: /W:1

[module:System.CLSCompliant(true)]   // CS3012
public class C
{
    public static void Main()
    {
    }
}