NuGet:是否需要引用隐式依赖项? [英] NuGet: Necessary to reference implicit dependencies?

查看:89
本文介绍了NuGet:是否需要引用隐式依赖项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近从ASP.NET Core 2.2升级。到3.0。随着元数据包的更改,我现在处在一切正常的状态,但是一些重要的软件包未明确引用。一切正常,因为它们被隐式引用。例如:

I recently upgraded from ASP.NET Core 2.2. to 3.0. With the changes regarding their meta packages, I'm now in a state where everything works, but some pretty important packages are not explicitly referenced. Everything works because, they're implicitly referenced. For example:

您可以看到我我明确引用了Microsoft.EntityFrameworkCore.SqlServer,但是我没有明确引用Microsoft.EntityFrameworkCore。因为它似乎是间接引用,所以它仍然被使用。

You can see that I'm explicitly referencing Microsoft.EntityFrameworkCore.SqlServer, however I am NOT referencing Microsoft.EntityFrameworkCore explicitly. It's still pulled in because it's an indirect reference it seems.

我的问题是:这是一个合理的项目配置吗?显式引入Microsoft.EntityFrameworkCore有什么好处?我想可能会对版本升级产生影响。

My question is: is this a reasonable project configuration? Is there any advantage to pulling in Microsoft.EntityFrameworkCore explicitly? I imagine there may be implications in terms of version upgrades.

谢谢...

推荐答案


这是合理的项目配置吗?

Is this a reasonable project configuration?

是。传递依赖绝对是SDK风格项目中的一件事,以我的经验,它们使工作变得简单得多。

Yes. Transitive dependencies are absolutely a thing in SDK-style projects, and in my experience they make life much simpler.

我只会添加一个冗余的NuGet引用以专门升级。该软件包-我只对次要发行版谨慎。例如,如果我使用依赖于软件包B v1.1的软件包A v1.0,则可能会添加对软件包B的依赖关系以升级到v1.2,而不升级到v2.0。

I would only add a redundant NuGet reference in order to specifically upgrade that package - and I'd be careful only do to that for minor releases. For example, if I use package A v1.0 that depends on package B v1.1, I might add a dependency on package B to upgrade to v1.2, but not to v2.0.

这篇关于NuGet:是否需要引用隐式依赖项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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