Pregunta

Question:
When analyzing assemblies from a whole lot of deployables is there a way to control how NDepend defines the "Application" domain? Or can I specify JustMyCode for the Dependency Matrix and Graph?

Background:
I am trying to determine all the third-party dependencies for all products in my company.

The easiest way to get all the binaries in one place was to copy all assemblies from a test server (rather than trying to pull down the source code for all 150+ separate deployables).

This means though that all third-party (ie nuget) dependencies seem to be included by NDepend in the pre-defined "Application" domain. And the ThirdParty domain contains only framework assemblies.

I have defined a query which identifies all assemblies that I consider to be Application code (ie where a.Name.Contains("MyCompanyName")) but I don't see a way to refine the NDepend Application domain using that query. I have used that query to alter the JustMyCode domain but there doesn't seem to be an option to specify JustMyCode for the Dependency Matrix or Graph.

I can see in Project Properties it's possible to move assemblies from Third party to Application but there doesn't seem to be an option to move assemblies from Application to Third party...?

I'm fairly new to NDepend - ideally I'd want to be able to see/define the following domains:

  • Framework (ie .net framework libs)
  • ThirdParty (including Microsoft.* libs)
  • Application
    • JustMyCode

Also I presume if I was analysing a single solution that NDepend would consider all nuget packages to be ThirdParty?

¿Fue útil?

Solución

Actually you don't need to reference all (i.e application + third-party) assemblies when defining your NDepend project. Just referencing the application assemblies should be enough, and NDepend has an heuristic to determine automatically third-party assemblies consumed from application ones.

Also, to make it easier to match the range of application assemblies stored in a hierarchy of folders, you can use Add .NET Assemblies in Folder + recursive child folder + Filter by name.

NDepend filter application assemblies by name

Once your NDepend project is populated with application assemblies, to get a dependencies matrix or graph of a subset of app assemblies, you can write a code query that matches this subset, and export matched assemblies to the graph or matrix:

Export NDepend assemblies to graph or dependency matrix

Also I presume if I was analysing a single solution that NDepend would consider all nuget packages to be ThirdParty?

Yes, because third-party assemblies will be found by the heuristic mentioned.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top