Sdílet prostřednictvím


Compilerwarnung (Stufe 1) CS3017

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

Diese Warnung tritt auf, wenn Sie ein Assemblyattribut CLSCompliant haben, das mit einem Modulattribut CLSCompliant in Konflikt steht. Eine Assembly, die CLS-kompatibel ist, kann keine nicht CLS-kompatiblen Module enthalten. Um diese Warnung zu beheben, prüfen Sie, ob die CLSCompliant-Attribute der Assembly und des Moduls beide true oder beide false sind. Sollte das nicht der Fall sein, entfernen Sie eines der Attribute. Weitere Informationen über die CLS-Kompatibilität finden Sie unter Schreiben von CLS-kompatiblem Code und CLS (Common Language Specification).

Beispiel

Im folgenden Beispiel wird CS3017 generiert:

// 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() {}
}