如何确定 .NET 应用程序的依赖关系?

How do I determine the dependencies of a .NET application?(如何确定 .NET 应用程序的依赖关系?)
本文介绍了如何确定 .NET 应用程序的依赖关系?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何确定 .NET 应用程序的依赖关系?Dependency Walker 是否适用于托管应用?我已经下载了最新版本并尝试分析该应用程序,但它只是退出而没有太多解释.如果它不适用于 .NET,那么是否有其他工具可以帮助我调试运行时 DLL 加载问题?

How do I determine the dependencies of a .NET application? Does Dependency Walker work with managed apps? I've downloaded the latest and tried profiling the app, but it just exits without much of an explanation. If it doesn't work with .NET, then is there some other tool that would help me debug a run-time DLL loading issue?

推荐答案

Dependency walker 适用于普通的 win32 二进制文件.所有 .NET dll 和 exe 都有一个小的 stub 标头部分,这使它们看起来像普通的二进制文件,但它基本上说的是加载 CLR"——这就是依赖分析程序会告诉你的全部内容.

Dependency walker works on normal win32 binaries. All .NET dll's and exe's have a small stub header part which makes them look like normal binaries, but all it basically says is "load the CLR" - so that's all that dependency walker will tell you.

要查看您的 .NET 应用程序实际依赖的东西,您可以使用非常出色的 .NET 反射器 从红门.(请注意,.NET Reflector 现在是付费产品.ILSpy 是免费和开源的,非常相似.)

To see which things your .NET app actually relies on, you can use the tremendously excellent .NET reflector from Red Gate. ( Note that .NET Reflector is now a paid product. ILSpy is free and open source and very similar.)

将您的 DLL 加载到其中,右键单击并选择分析" - 然后您将看到一个取决于"项,它将向您显示它需要的所有其他 dll(以及这些 dll 中的方法).

Load your DLL into it, right click, and chose 'Analyze' - you'll then see a "Depends On" item which will show you all the other dll's (and methods inside those dll's) that it needs.

但有时它会变得更棘手,因为您的应用依赖于 X dll,并且存在 X dll,但由于某种原因无法在运行时加载或定位.

It can sometimes get trickier though, in that your app depends on X dll, and X dll is present, but for whatever reason can't be loaded or located at runtime.

为了解决这些问题,Microsoft 有一个 AssemblyBinding Log Viewer 可以显示运行时发生的事情

To troubleshoot those kinds of issues, Microsoft have an Assembly Binding Log Viewer which can show you what's going on at runtime

这篇关于如何确定 .NET 应用程序的依赖关系?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
quot;Overflowquot; compiler error with -9223372036854775808L(编译器错误-9223372036854775808L(Q;溢出Q))
Visual Studio 2010 ReportViewer Assembly References(Visual Studio 2010 ReportViewer程序集引用)
Weird behaviour when I open a reportviewer in WPF(在WPF中打开报表查看器时出现奇怪的行为)
how do i pass parameters to aspnet reportviewer(如何将参数传递给aspnet report查看器)