共用方式為


編譯器警告 (層級 1) CS3017

更新:2007 年 11 月

錯誤訊息

您在模組上指定的 CLSCompliant 屬性,不能與組件上的 CLSCompliant 屬性不同

如果組件 (Assembly) 上的 CLSCompliant 屬性 (Attribute) 與模組上的 CLCompliant 屬性互相衝突,便會產生這個警告。符合 CLS 標準的組件不能包含不符合 CLS 標準的模組。若要解決這個警告,請確定組件和模組上的 CLSCompliant 屬性皆為 true 或皆為 false,或移除其中一個屬性。如需 CLS 標準符合性的詳細資訊,請參閱撰寫符合 CLS 標準的程式碼Common Language Specification

範例

下列範例會產生 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() {}
}