1

私はこのビットのCQLを持っています:

// <Name>A stateless class or structure might be turned into a static type</Name>
warnif count > 0 (from t in Application.Types where
  t.SizeOfInst ==0 &&

  // For accuracy, this constraint doesn't take
  // account of types that implement some interfaces.
  // and classes that have a base class and don't
  // derive directly from System.Object, or classes
  // that have sub-classes children.  
  t.NbInterfacesImplemented == 0 &&                           
  ((t.IsClass && t.DepthOfInheritance == 1   
            && t.NbChildren == 0)          
    || t.IsStructure) &&                   
  !t.IsStatic &&
  !t.DeriveFrom("System.Attribute") &&
  !t.IsAttributeClass &&
  !t.IsGeneric && t.Name!="Program" && !(t.IsGeneratedByCompiler || t.HasAttribute(@"NDepend.CQL.NDependIgnoreAttribute") || t.HasAttribute("System.Runtime.CompilerServices.CompilerGeneratedAttribute".AllowNoMatch()))
select new { t, t.SizeOfInst, t.NbInterfacesImplemented, 
             t.DepthOfInheritance, t.NbChildren }).Take(10)
  // this rule indicates stateless types that might 
  // eventually be turned into static classes.
  // See the definition of the SizeOfInst metric here 
  // http://www.ndepend.com/Metrics.aspx#SizeOfInst

GUI では問題ありませんが、コマンド ラインから実行すると出力レポートに次のメッセージが表示されます。

1 query syntax error: Not a valid type name {"System.Attribute"}

理由はありますか?

4

1 に答える 1

1

mscorlibこれは、 を含むアセンブリがSystem.Attribute解析時に解決されないという事実に由来するに違いありません。同じマシンで GUI バージョンとコマンド ライン バージョンを実行していますか? アセンブリの解決を確認するには、[NDepend Project Properties] > [Code to Analyzemscorlib ] に移動し、フォルダー パネルを展開して解決された場所を確認します。

于 2013-07-20T18:12:03.470 に答える