Visual Studio 联机和自动 Nuget 包还原失败

Visual Studio Online and Automatic Nuget Package Restore are failing

我有一个包含几个项目的 VS2015 解决方案。当我签入 VSO 时,我收到了一堆这样的错误消息:

This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is ...

这意味着 Nuget 没有恢复包。 SO 上的一些其他帖子建议在解决方案级别启用 Nuget 还原,这会向解决方案添加 3 个文件并更新项目。

问题是 Visual Studio 2015 不再提供此功能,因为它现在支持自动 Nuget 包还原功能。 Nuget官方文档也不是很清楚。任何帮助将不胜感激。

确保从 "Visual Studo\Tools\Options\NuGet Package Manager" 中检查 "Allow NuGet to download missing packages" 和 "Automatically check for missing packages during build in Visual Studio"。然后 运行 按照 "Package Manager Console" 的命令重新安装所有 NuGet 包:

Update-package -reinstall

我通过从我的 VSO 项目中删除 packages 文件夹解决了这个问题。现在,当我签入时,它可以正确恢复包并成功构建。