有一些工具,如Dependency Walker,dumpbin,ildasm,用于查看Windows上的DLL / EXE文件。我想从代码中分析DLL,尤其是托管和非托管的依赖项。是否有任何(.NET)库可用于分析具有类似功能的文件?
我想用它来验证我们正在我公司正在创建的安装程序中部署正确的DLL。我们有超过200个DLL。
答案 0 :(得分:3)
NDepend确实是您正在寻找的工具,但您还应考虑减少程序集的数量,如下所述: Advices on partitioning code through .NET assemblies
答案 1 :(得分:3)
答案 2 :(得分:1)
如果要进行自己的依赖项检查,可以为Visual Studio编写用于托管代码程序集的代码分析(FxCop)插件。
Tutorial on writing your own Code Analysis rule
如果您需要预先构建的工具,可以使用:
答案 3 :(得分:1)
我希望这不违反任何规则,但你可能想要查看我开发的库,它可以在其他一堆东西中看到图像导入和导出。从这里下载源代码:https://sourceforge.net/projects/processhacker/files。提取ProcessHacker.Common和ProcessHacker.Native,将它们包含在您的解决方案中,并引用它们。
以下是如何使用它:
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);
}
我不知道如何处理.NET引用。