更新解决方案中所有项目中的nuget包 [英] Updating nuget packages in all projects in a solution

查看:47
本文介绍了更新解决方案中所有项目中的nuget包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含多个项目(例如B,C,D)的.net解决方案(例如A).我想为解决方案中的所有项目更新所有nuget软件包.我知道我可以使用命令行更新nuget软件包,但可以将路径传递给packages.config

I have a .net solution (say A) with multiple projects(say B,C,D). I want to update all nuget packages for all projects in the solution. I know I can update nuget packages using command line but passing in the path to packages.config

nuget update A/B/packages.config

有没有一种方法可以使用命令行更新文件夹A中所有package.configs的软件包,而不必单独指定它们?(我知道这可以在Visual Studio内部完成.)

Is there a way to update packages for all packages.configs inside folder A using command line without having to specify them individually? (I know this can be done from inside visual studio.) Something like

nuget update A/*/packages.config

推荐答案

这将:

将当前解决方案的所有项目中的所有软件包更新为最新版本.

Update all packages in all projects of the current solution to the latest versions.

要打开程序包管理器控制台,请执行以下操作:

To open the Package Manager Console:

工具> NuGet软件包管理器>软件包管理器控制台

现在,为了只拥有所有软件包的一个实例,我在解决方案文件夹中有一个名为 nuget.config 的文件,该文件包含:

Now, in order to have only one instance of all packages, I have, in my solution folder, a file named nuget.config that contains:

<configuration>
  <config>
    <add key="repositoryPath" value="..\Path\To\My\Packages" />
  </config>
</configuration>

您可能需要重新加载解决方案才能使其正常工作.

You might need to reload your solution in order to make it work properly.

这篇关于更新解决方案中所有项目中的nuget包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆