依赖性检查
有什么方法可以检查 .Net 程序集所需的所有依赖项是否都已满足?它位于生产服务器上,并且未安装 Visual Studio。
它是一个 .Net 程序集,需要一些 GAC:ed 组件,这些组件未包含在安装包中。
Are there any way to check if all dependencies required by a .Net assembly is fulfilled? It's on a production server and Visual Studio is not installed on it.
It's a .Net assembly which requires some GAC:ed components which are not included in the installation package.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
这里有一个简单的工具:
http://www.amberfish.net/
虽然它不完全支持 x64。我会接受任何具有类似工具但也支持 x64 的答案。
Here are a simple tool:
http://www.amberfish.net/
Though it doesn't fully support x64. I'll accept any answer that has a similar tool but also supports x64.
对于 NDepend 代码库,我们在 GAC 中没有特定的依赖项。但是,NDepend 会在每次 NDepend 执行时检查所有程序集是否在安装中正确部署。这样,如果用户调整了安装(我们注意到确实发生了),他会得到一个智能 MessageBox,准确解释发生了什么以及为什么他应该重新部署 NDepend。由于这个技巧,我们节省了很多支持。
我们的实现只是基于 Mono.Cecil 来检查所有程序集是否存在于该位置它应该,具有正确的汇编版本。使用 Mono.Cecil 对程序集进行浅读的速度非常快,因此不会减慢启动时间。
For the NDepend code base, we have no specific dependency in the GAC. However NDepend do check that all assemblies are well-deployed in the installation, at each NDepend execution. This way, if the user tweaked the installation (which DO happen, we notice) he gets a smart MessageBox explaining exactly what happen and why he should re-deploy NDepend. A lot of support has been saved thanks to that trick.
Our implementation is simply based on Mono.Cecil that does check that all assemblies are present in the the location it should, with the right assembly version. Doing shallow read on assembly is so fast with Mono.Cecil that doing so doesn't slow down the startup time.
融合日志是一种方式, http://www.hanselman.com/blog/DetailingFailedAssemblyLoadsWithTheAssemblyBindingLogViewerTheFusionLogger.aspx
另一种方法是在另一台具有相同 CPU 位数的计算机上安装 Debugging Tools for Windows,然后将安装文件夹复制到该服务器。然后就可以使用里面的WinDbg来轻松排查此类问题。当然,这对于初学者来说并不容易。
Fusion log is one way, http://www.hanselman.com/blog/DetailingFailedAssemblyLoadsWithTheAssemblyBindingLogViewerTheFusionLogger.aspx
Another way is to install Debugging Tools for Windows on another machine with the same CPU bitness, and then copy the installation folder to this server. Then you can use WinDbg in it to easily troubleshoot such problems. Of course, this is not easy for beginners.
ILSpy - 开源 .NET 程序集浏览器和反编译器。它还显示了依赖性。
Reflector 的不错替代品,它不再免费了。
ILSpy - an open-source .NET assembly browser and decompiler. It shows dependencies as well.
Decent replacement for Reflector which is not free any more.