简体   繁体   English

如何在单个nuget cli命令中将多个软件包更新到所需版本?

[英]How to update multiple packages to a desired version in single nuget cli command?

From Nuget CLI is it possible from a single command to upgrade multiple packages to the desired version? Nuget CLI是否可以通过单个命令将多个软件包升级到所需版本?

I know we can do 我知道我们可以做

nuget.exe update "FooBar.sln" MyPackage -Version 1.0

but what if I want to update 2 packages to 1.0 ? 但是,如果我想将2个软件包更新为1.0怎么办?

This still updates to the latest version but not to the version I desire. 这仍会更新为最新版本,但不会更新为我想要的版本。

nuget.exe update "FooBar.sln" -Id MyPackage -Id MyPackage2 -Version 1.0

What will be the command for that and will there be any dependency on each other like both package will update only when they both are on a project ( https://stackoverflow.com/a/16302774/1011959 )? 这将是什么命令,并且彼此之间是否有任何依赖关系,例如这两个软件包仅在它们都在项目中时才会更新( https://stackoverflow.com/a/16302774/1011959 )?

It's possible to specify package version only when you update one package. 仅当更新一个软件包时才可以指定软件包版本。 If you want to do it with NuGet Cli and in one command, you can join several commands like that 如果要使用NuGet Cli并在一个命令中执行此操作,则可以将多个类似的命令连接起来

nuget.exe update "FooBar.sln" MyPackage -Version 1.0 && nuget.exe update "FooBar.sln" MyPackage2 -Version 2.0

With this approach you can specify different versions for different packages. 使用这种方法,您可以为不同的软件包指定不同的版本。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM