How NDepend is Resolving Assemblies

Since NDepend v2019.1 the NDepend project file can also reference one or several Visual Studio solution(s) and project(s) from which some .NET Application Assemblies to analyze are resolved. The resolution of these assemblies is not concerned with the heuristic explained below since they are resolved from Visual Studio solution(s) and project(s) files referenced.

Note that the set of applications assemblies analyzed is the union of those Visual Studio solution(s) assemblies (4 dlls in the screenshot below), and assemblies referenced by name (only one executable in the screenshot below).

ndepend project can reference assemblies and visual studio solution

The NDepend project file (.ndproj extension) contains 2 lists of assembly names (case insensitive, without extension .dll .exe)

  • One list for Application Assemblies Names,
  • One list for Third-Party Assemblies Names (inferred automatically from the Application Assemblies list)

The NDepend project also contains a list of directories. These directories can be specified as absolute, relative to .ndproj, prefixed with an environment variable ... in the tab Project Properties > Paths Referenced

To resolve assemblies, NDepend attempts to locate assemblies by name in the directories.

ndepend project paths referenced

This list of directories also contain .NET Fx directories like C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319 to resolve third-party .NET Fx assemblies referenced by your Application assemblies.

The .NET profiles supported are .NET Fx, .NET Core, Win RT and Silverlight.

ndepend project dotnet profile

Since NDepend v2017.3, the .NET Core profile is supported and also NuGet directories are automatically resolved.

An heuristic is resolving the right version of referenced assemblies in the NuGet packages directories.

This heuristic is relying on .deps.json files (if found) to determine the referenced NuGet package names.

ndepend project dotnet profile directories

If several assemblies with the same name are found in several directories, here is the heuristic used to resolve the assembly to analyze:

  • For application assemblies: the one with highest version
  • For third-party assemblies: the one with the version found in application assemblies references
  • else, the one with biggest file (in terms of bytes)
  • else the one most recently modified
  • else any, they are reported as all same.

If you are using the NDepend.API to create a program that builds NDepend projects, see the interface NDepend.Project.IProjectCodeToAnalyze.