c# - 在 .NET 中,我什么时候必须引用外部库也引用的 DLL?

标签 c# .net clr

<分区>

我试图了解我的 .NET 项目何时需要引用外部库引用的 DLL。

一个实际例子:Microsoft.Bot.Builder依赖于Chronic.Signed.dll

如果我引用 Microsoft.Bot.Builder.dll,我是否也必须在我自己的项目中添加对 Chronic.Signed.dll 的引用,即使我没有直接使用它?还是只有在某些情况下我才需要?

最佳答案

If I reference Microsoft.Bot.Builder.dll, do I always have to also add a reference to Chronic.Signed.dll in my own project, even if I'm not using it directly? Or do I only have to only under certain circumstances?

当您使用 NuGet 添加包时,依赖包也会随它们一起安装。因此,当您添加 Microsoft.Bot.Builder.dll 时,它也会自动安装 Chronic.Signed.dll。

现在到了,为什么?一些 lib 包依赖于其他包。就像 Microsoft.Bot.Builder.dll 中的一个函数可能正在使用 Chronic.Signed.dll 中的一些辅助函数或主要函数。因此,如果您删除 Chronic.Signed.dll 的引用,您将收到缺少依赖项或引用的错误。

do I always have to also add a reference to Chronic.Signed.dll in my own project, even if I'm not using it directly?

是的,因为 Microsoft.bot 在内部使用它。

并非所有包都依赖于其他包。有些是独立的,从不安装任何其他 dll,但有些会。

关于c# - 在 .NET 中,我什么时候必须引用外部库也引用的 DLL?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47278670/

相关文章:

c# - 如何检查Web服务器是否启动? (C#)

html - ASP.NET MVC 动态表单

c# - gcroot 和/clr 混合模式和 C++ 包装器是从纯 C 到 C# 的最短路径吗?

c# - 在 C# 中使用自定义 F# 运算符?

C# 如何手动清除 TCP 套接字缓冲区?

c# - AspNet.Security.OpenIdConnect.Server。刷新 token

.net - 在 asp.net mvc 2.0 中使用 Html.DropDownListFor 助手时如何更改 id 值?

c# - WinForms 动态本地化

.net - CLR之间的差异

c# - 从代码隐藏调用 JavaScript 函数