简体   繁体   English

如何将更新版本的 NuGet 包用于 .NET Core 3.1 中的依赖包?

[英]How to use a more recent version of a NuGet package for dependent packages in .NET Core 3.1?

I have a NuGet package that references Newtonsoft.Json v 12.0.2.我有一个引用 Newtonsoft.Json v 12.0.2 的 NuGet 包。 I can't access the source to that NuGet package.我无法访问该 NuGet 包的源代码。 (Technically, NuGet Package Explorer stats that it's really >= 12.0.2 ) (从技术上讲,NuGet 包资源管理器统计它确实 >= 12.0.2 )

If I wish for that package to leverage Newtonsoft.Json v 12.0.3, is it as simple as me "installing" v 12.0.3 into my project and all dependants (and their children, etc) which are using v 12.0.2 will now be magically using my installed 12.0.3 version?如果我希望该软件包能够利用 Newtonsoft.Json v 12.0.3,是否就像我将 v 12.0.3“安装”到我的项目中一样简单,并且所有使用 v 12.0.2 的依赖项(及其孩子等)都将现在神奇地使用我安装的 12.0.3 版本?

Or does each dependency only use the version explicitly defined in their package?还是每个依赖项仅使用其包中明确定义的版本?

What is this called?这个叫什么? explicit referencing?显式引用?

Other Info: This is for .NET Core 3.1其他信息:这适用于 .NET Core 3.1

For the new sdk project, when you install a nuget package, it will install its lowest dependencies on your project and if you want to use the higher version, you only need to install the updated dependency nuget package separately and then it will update all the dependencies to the updated version.对于新的sdk项目,当你安装一个nuget包时,它会在你的项目上安装它最低的依赖,如果你想使用更高的版本,你只需要单独安装更新的依赖nuget包,然后它会更新所有的对更新版本的依赖。

And it will update all dependencies of your project to that version.它会将您项目的所有依赖项更新到该版本。 Note that it will not act on a single nuget package but all.请注意,它不会对单个 nuget 包起作用,而是对所有包起作用。

These two nuget packages used Newtonsoft.Json 12.0.2 dependency这两个nuget包使用了Newtonsoft.Json 12.0.2依赖

在此处输入图片说明

And if I install Newtonsoft.Json 12.0.3 nuget package separately:如果我安装Newtonsoft.Json 12.0.3分别NuGet包:

在此处输入图片说明

They all used Newtonsoft.Json 12.0.3 and it proves that they are Shared rather than using a separate version.他们都使用了Newtonsoft.Json 12.0.3 ,这证明它们是共享的,而不是使用单独的版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 引用 a.Net Core 3.1 NuGet package 的 a.Net 5 Visual Studio 项目/解决方案如何编译成功? - How can a .Net 5 Visual Studio Project / Solution that reference a .Net Core 3.1 NuGet package compile successfuly? 如何通过 NuGet 包共享源代码以用于 .NET Core 项目 - How to share source code via NuGet packages for use in .NET Core projects NuGet 包管理器尝试将 .NET 5.0 更新添加到 .NET Core 3.1 应用程序 - NuGet Package Manager attempting to add .NET 5.0 updates to .NET Core 3.1 application 如何将 TypeScript 定义添加到 .NET Core Nuget 包 - How to add TypeScript Definitions to .NET Core Nuget Packages 更新软件包时如何防止nuget还原到从属软件包的旧版本 - How to prevent nuget from reverting to older versions of dependent packages when updating a package Nuget 软件包未在 .net 核心应用程序中安装任何内容 - Nuget Packages not installing anything in .net core app Visual Studio 2017仅具有适用于.NET Core 2.x的脱机Nuget包。如何获得在线套餐? - Visual Studio 2017 only has offline Nuget Packages for .NET Core 2.x. How to get online packages? .NET Core package版本冲突如何解决 - How to resolve .NET Core package version conflicts 无法在.net Core中复制带有nuget包的文件夹 - Cannot copy folder with nuget package in .net core 无法使用正确的.NET版本安装NuGet包 - Could not install NuGet package with the correct .NET version
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM