In a nutshell: I want to do the same thing \"Dependency Walker\" does.
Is there any Win32 API function which can enumerate the dependencies of a EXE and/or DLL file?
You can write a console app to wrap this up, create a PowerShell script with it or, like I usually end up doing since I only have to do it once in a blue moon, add the following to your code for a quick check:
private static HashSet<string> ReferencedAssemblies = new HashSet<string>();
...
OutputDependencies(Assembly.GetAssembly(typeof(Program)), 0);
...
static void OutputDependencies(Assembly assembly, int indent)
{
if (assembly == null) return;
Console.WriteLine(new String(' ', indent * 4) + assembly.FullName);
if (!ReferencedAssemblies.Contains(assembly.FullName))
{
ReferencedAssemblies.Add(assembly.FullName);
foreach (var childAssembly in assembly.GetReferencedAssemblies())
{
OutputDependencies(Assembly.Load(childAssembly.FullName), indent + 1);
}
}
}