Почему NDepend показывает ошибки CQL при запуске из командной строки, но не из графического интерфейса?
У меня есть немного 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
Это нормально в графическом интерфейсе, но я получаю это сообщение в отчете о выходе, когда я запускаю его из командной строки:
1 query syntax error: Not a valid type name {"System.Attribute"}
Есть идеи почему?
1 ответ
Это должно исходить из того, что mscorlib
сборка, которая содержит System.Attribute
не решается во время анализа. Используете ли вы версии GUI и командной строки на одном компьютере? Для просмотра разрешения сборки перейдите в раздел Свойства проекта NDepend> Код для анализа и посмотрите, откуда mscorlib
решается путем развертывания панели папок.