NuGet:需要引用隐式依赖项?

NuGet: Necessary to reference implicit dependencies?(NuGet:需要引用隐式依赖项?)
本文介绍了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:需要引用隐式依赖项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

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

相关文档推荐

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查看器)