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.
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: