为什么nuget命令行工具不遵循依赖关系? [英] Why does the nuget command line tool not follow dependencies?

查看:262
本文介绍了为什么nuget命令行工具不遵循依赖关系?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据此问题:



使用nuget.exe命令行安装依赖关系



命令行NuGet工具不会有意地遵循依赖关系。虽然我可以理解这是默认行为,似乎奇怪的是,没有选择让工具遵循依赖关系。有人知道这背后的原因吗?

解决方案

这个回答是特定于运行 nuget安装包。 config



当指定 packages.config 时,只安装明确列出的包。

$ b然而,如果你尝试安装一个特定的包: nuget install My.Package.Id ,那么NuGet将安装包和任何依赖。 / p>

EDIT 有关为何有区别的其他信息。



nuget install 应该被称为 nuget下载。它不是真正的安装在传统意义上。也就是说,它不会添加对您的项目文件的引用,它不会运行 install.ps1 ,它不会更新 packages.config 等等。以使用NuGet GUI或软件包管理器控制台获取真实安装。



由于 true 安装更新 packages.config ,所以此文件已包含所有已安装的依赖项。所以指定文件意味着,我想下载这些特定的包。 NuGet不需要考虑它,因为它基本上是预先计算的



如果你想安装/下载多个软件包,遵循依赖关系,只需创建一个批处理文件并发出多个命令:

  nuget install My.Package.Id 
nuget install Another.Package.Id

这将导致NuGet获取包可能有的任何依赖。 / p>

希望这澄清事情。


According to this question:

using nuget.exe commandline to install dependency

The command line NuGet tool does not follow dependencies intentionally. While I could understand this as the default behavior, it seems odd to me that there is no choice to have the tool follow the dependencies. Is anyone aware of the reasoning behind this?

解决方案

That answer is specific to running nuget install packages.config.

When specifying packages.config, only explicitly listed packages are installed.

However, if you try installing a specific package: nuget install My.Package.Id then NuGet will install the package and any dependencies.

EDIT Additional info as to why there's a distinction.

nuget install should really be called nuget download. It doesn't really install in the traditional sense. That is, it doesn't add references to your project files, it doesn't run install.ps1, it doesn't update packages.config, etc. You need to either use the NuGet GUI or Package Manager console to get a true install.

Since the true install updates packages.config, this file already includes all the dependencies that were installed. So specifying the file means, I want to download these specific packages. NuGet doesn't need to think about it since it's basically pre-calculated.

If you want to install/download multiple packages and have NuGet follow dependencies, just create a batch file and issue multiple commands:

nuget install My.Package.Id
nuget install Another.Package.Id

This will cause NuGet to fetch the package an any dependencies it may have.

Hope this clarifies things.

这篇关于为什么nuget命令行工具不遵循依赖关系?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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