引用第三方程序集的最佳做法 [英] Best practices for referencing 3rd party assemblies

查看:88
本文介绍了引用第三方程序集的最佳做法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在想,在引用第三方程序集时,最好的做法是什么。前一段时间我提出了一个问题:依赖关系和参考文献:我该怎么做参考,并收到了一些想法,但我不完全相信。我有一个建立我的项目所需的第三方会议,根据我目前所读的内容,我只应该参考构建项目所需的程序集。这将留下第三方程序集的运行时依赖关系的问题。如果我也参考这些参考,那么引用列表变得巨大(因为有几个依赖关系),并且包含很多程序集,我不知道什么和真正与我的项目无关。另外我想避免在任何一个使用公共方法,只是使用主要的第三方组件。我怎么能以一个体面的方式去做这个?
任何帮助都不胜感激,因为我很困惑。

I have been wondering what are best practices when it comes to referencing 3rd party assemblies. A while ago I asked a question "Dependencies and references: what exactly should I reference" and received something to think about but I am not completely convinced. I have a 3rd party assembly needed for building my project and according to what I have read so far I should only reference assemblies needed for building my project. This leaves the problem of the runtime dependencies of the 3rd party assembly. If I reference those too the list of references becomes huge (as there are several dependencies) and includes a lot of assemblies I have no clue what do and are really not related to my project. Also I want to avoid using public methods in any of those and just use the main 3rd party assembly. How can I go about doing this in a decent way? Any help is appreciated as I am quite confused.

给我一​​个想法,我在这里处理的是第三方库使用hibernate和log4net

To give an idea of what I am dealing with here is the 3rd party library uses hibernate and log4net along with office interop assemblies.

谢谢。

推荐答案

如果我有处理未在GAC中注册的图书馆,我使用以下方法:

If i have to deal with libraries that aren't registered in the GAC, I use the following method:


  • 将所有第三个文件夹Libs派对图书馆及其依赖关系

  • 参考我需要的

  • 创建一个后建立动作,复制Libs中的所有文件文件夹到bin / debug(或release)文件夹

如果不了解依赖关系,可以使用 Dependency Walker

If you don't know the dependencies, you can use Dependency Walker.

这篇关于引用第三方程序集的最佳做法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆