質問
私は、その方法のいくつかに次の属性を持っているコードに取り組んでいます。
[CLSCompliantAttribute(false)]
コードをそのまま作成すると、コンプライアンスチェックが実行されていることがわかり、コメントすると、コンプライアンスチェックが実行されていないようです。
私は反対の行動を期待していました...
解決
追加 [CLSCompliant(false)]
メンバーをマークして、非準拠として追加します。
メンバーを非準拠としてマークした場合、コンパイラは準拠していない場合は警告しません。 (あなたはすでにそれが準拠していないと言っていたので。)
ただし、メンバーが準拠としてマークされている場合(アセンブリレベルの属性から明示的または間接的に)、実際には準拠していない場合(たとえば、 uint
)、コンパイラはあなたに警告します(属性がメンバーについて嘘をついているので)。
他のヒント
たとえば、AssemblyInfo.csに追加し、すべてのアセンブリをグループ化できます。好き :
using System;
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCulture("")]
[assembly: CLSCompliant(false)]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("d29c53b6-88e4-4b33-bb86-f39b4c733542")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
所属していません StackOverflow