Search code examples
visual-studiodependencies

How to find which Visual Studio Dependency is using a particular DLL?


I have a VS 2022 solution with approximately 100 projects in it. One particular project references several other projects, and also pulls in a dozen nuget packages.

When I build that project, it includes Microsoft.ApplicationInsights.dll in the bin folder. My project doesn't use it.

Is there a fast way to find out which dependency is including it in the bin? Thanks


Solution

  • Your project doesn't use it directly, but maybe a NuGet package uses it. Maybe you can try the NDepend Project Dependency Diagram feature that also shows dependencies to the referenced assemblies. To do so:

    • Download NDepend trial full featured
    • Unzip and start VisualNDepend.exe
    • on the Start Page click Analyze .NET assemblies in folder
    • point the dialog to the folder that contains all your assemblies
    • eventually check Recursive child folder
    • Start analyze
    • Go to the NDepend Dependency Graph panel > Filers > uncheck Exclude Third-Party
    • Use the Search graph feature and type Microsoft.ApplicationInsights to see who is using it NDepend choose assemblies NDepend Dependency Graph

    You can also right click the assembly > Show on Dependency Grap to see direct callers

    Right-click  shown on dependency graph

    Usage of an assembly