Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
23 views
in Technique[技术] by (71.8m points)

.net - NuGet: Necessary to reference implicit dependencies?

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:

enter image description here

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.

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.

Thanks...

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Is this a reasonable project configuration?

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

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...