2

I would like to run a report on how many methods in a particular assembly and its sub-assemblies have and do not have certain attribute. Can you write to me a sample code for this? What are the reporting options? I need to run this report every night.

Alpha01
  • 838
  • 6
  • 13

1 Answers1

1

You could write something like:

(from m in Application.Assemblies.WithNameLike("^MyAssembly").ChildMethods()
 where m.HasAttribute("NamespaceA.AttributeA") &&
       m.HasAttribute("NamespaceB.AttributeB") &&
      !m.HasAttribute("NamespaceC.AttributeC")
 select m).Count()

Note that the aggregate call to Count(), that can be removed if you wish to list methods instead of counting them.

I need to run this report every night.

Here is the relevant documentation:

Patrick from NDepend team
  • 13,237
  • 6
  • 61
  • 92