简体   繁体   English

如何将解决方案的所有包更新到最新的次要版本 Nuget?

[英]How to Update All Packages of solution to Latest Minor Version Nuget?

Stick together with minor versions of updated packages, in the entire solution.在整个解决方案中坚持使用更新包的次要版本。

Ideally Update-Package should do but that command will pick up latest version of all packages, no matter what.理想情况下 Update-Package 应该这样做,但无论如何该命令都会获取所有包的最新版本。

EDIT: I'm hopeful that there exists a switch, so that we don't have to type in specific versions of all packages one by one, NPM, where are you, can you manage DLLs as well;-)编辑:我希望有一个开关,这样我们就不必一个一个地输入所有包的特定版本,NPM,你在哪里,你也可以管理 DLL 吗;-)

I managed to upgrade all my packages to their latest minor version by using the dotnet-outdated global tool like this:我设法使用dotnet-outdated全局工具将我的所有软件包升级到最新的次要版本,如下所示:

dotnet tool install --global dotnet-outdated
dotnet outdated --version-lock major --upgrade

It upgraded all the packages in that folder without any problems of intermediary downgrade errors.它升级了该文件夹中的所有软件包,而没有任何中间降级错误的问题。

UPDATE NOV 2020 2020 年 11 月更新

According to Scott Hanselman , dotnet outdated is outdated .根据Scott Hanselman 的说法, dotnet outdated已经outdated Long live the dotnet-outdated-tool ! dotnet-outdated-tool万岁!

dotnet tool install --global dotnet-outdated-tool
dotnet outdated --version-lock major --upgrade

Command you are looking for is:您正在寻找的命令是:

Update-Package -ToHighestMinor

Above command is available only within the NuGet Package Manager Console in Visual Studio (and PowerShell) on Windows.以上命令仅在 Windows 上的 Visual Studio(和 PowerShell)中的 NuGet Package 管理器控制台中可用。

There is other similar command (which which works in both VS and CLI):还有其他类似的命令(适用于 VS 和 CLI):

Update-Package -ToHighestPatch

nuget update -safe

Please note the difference - first command will upgrade to highest Minor , but second and third commands will upgrade only to highest Patch .请注意区别——第一个命令会升级到最高的Minor ,而第二个和第三个命令只会升级到最高的Patch

Also take a look on -DependencyVersion [Lowest, HighestPatch, HighestMinor, Highest, Ignore] parameter, might be useful in some cases.另请查看-DependencyVersion [Lowest, HighestPatch, HighestMinor, Highest, Ignore]参数,在某些情况下可能会有用。

More details:更多细节:

You should be able to use something like Install-Package Microsoft.AspNetCore.Mvc -Version 2.2.0 as described here microsoft docu您应该能够使用类似Install-Package Microsoft.AspNetCore.Mvc -Version 2.2.0类的东西,如此处microsoft Install-Package Microsoft.AspNetCore.Mvc -Version 2.2.0

for multiple packages you can easily connect multiple calls by ';'对于多个包,您可以通过“;”轻松连接多个呼叫as mentioned in an old answer旧答案中所述

查看 nukeeper 以帮助实现此目标https://github.com/NuKeeperDotNet/NuKeeper

While searching on this I found an open source dotnet tool which can update nuget packages on both .NET framework and .NET Core.在搜索这个时,我发现了一个开源 dotnet 工具,它可以更新 .NET 框架和 .NET Core 上的 nuget 包。 nukeeper.com nukeeper.com

You need to install the package with dotnet tool install nukeeper --global and then simply use nukeeper update .您需要使用dotnet tool install nukeeper --global ,然后只需使用nukeeper update It can also automatically create PR if you use it in your CI environment如果你在你的 CI 环境中使用它,它还可以自动创建 PR

Using Visual Studio, this is trivially easy.使用 Visual Studio,这非常容易。

Right click on your Solution file (or project depending on which you want to update) and select "Manage NuGet Packages...".右键单击您的解决方案文件(或项目,具体取决于您要更新的项目)并选择“管理 NuGet 包...”。 From there switch over to the "Updates" tab select the checkbox where it says "Select all packages" and then click "Update".从那里切换到“更新”选项卡,选中“选择所有包”的复选框,然后单击“更新”。 This will update all packages to their latest stable release, including minor version (eg 'v4.5.1 -> v4.5.3')这会将所有软件包更新到最新的稳定版本,包括次要版本(例如“v4.5.1 -> v4.5.3”)

Manage NuGet Packages管理 NuGet 包

管理 NuGet 包

Navigate to Updates Tab导航到更新选项卡

导航到更新

Select all packages选择所有包

选择所有包

And finally update all packages最后更新所有包

更新

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

相关问题 如何在单个nuget cli命令中将多个软件包更新到所需版本? - How to update multiple packages to a desired version in single nuget cli command? 获取解决方案中使用的所有 NuGet 包的列表 - Get a list of all NuGet packages used in a solution 如何在nuget界面上启用“更新所有软件包”按钮? - How to enable “update-all packages” button at nuget interface? 如何使用最新的NuGet软件包支持库更新xamarin android项目? - How can I update my xamarin android project with the latest NuGet packages support libraries? NuGet - 在单一解决方案中管理和删除多版本软件包 - NuGet - managing and removing multi version packages in single solution 是否可以在Xamarin 3中更新部分但不是全部的NuGet软件包? - Is it possible to update some but not all NuGet packages in Xamarin 3? 如何使用 Visual Studio 2022 为解决方案中的所有项目全局管理 nuget 包? - How to manage nuget packages globally for all projects in a solution using Visual Studio 2022? 在Visual Studio 2015解决方案中恢复所有Nuget包 - Restoring all Nuget Packages in a Visual Studio 2015 Solution 如何在解决方案中使用特定版本的nuget dll - How to use specific version of nuget dll in solution 在解决方案中升级NuGet版本 - Upgrading NuGet version in solution
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM