Reputation: 7506
There are tools like Dependency Walker, dumpbin, ildasm for looking into DLLs/EXE files on Windows. I would like to analyze DLLs from code, especially dependencies both managed and unmanaged. Are there any (.NET) libraries out there for analyzing with similar functionality?
I want to use this to verify that we am deploying the right DLLs in setup program my company are creating. We have more than 200 DLLs.
Upvotes: 3
Views: 237
Reputation: 17499
You can use the Cecil library to analyze managed executables. And you can use Gendarme that uses Cecil if you want a rule engine to check your application.
Upvotes: 3
Reputation: 13842
NDepend is indeed the tool you are looking for but you should also consider decreasing the number of assemblies as explained here: Advices on partitioning code through .NET assemblies
Upvotes: 3
Reputation: 8393
I hope this doesn't break any rules, but you might want to look into a library I've developed which can see image imports and exports among a heap of other things. Download the source code from here: https://sourceforge.net/projects/processhacker/files. Extract ProcessHacker.Common and ProcessHacker.Native, include them in your solution, and reference them.
Here's how to use it:
using ProcessHacker.Native.Image;
MappedImage image = new MappedImage("file.exe");
for (int i = 0; i < image.Imports.Count; i++)
{
Console.WriteLine("Imports for " + image.Imports[i].Name + ":");
for (int j = 0; j < image.Imports[i].Count; j++)
Console.WriteLine(image.Imports[i][j].Name);
}
I don't know how to deal with .NET references though.
Upvotes: 1
Reputation: 25704
If you want to do your own dependency checking you can write Code Analysis (FxCop) plugins for Visual Studio for managed code assemblies.
Tutorial on writing your own Code Analysis rule
If you want pre-built tools you can use:
Upvotes: 1