无法使用 Nuget 包还原将 Newtonsoft.Json 从 10.0.1 更新到 10.0.2

Unable To Update Newtonsoft.Json From 10.0.1 to 10.0.2 Using Nuget Package Restore

我无法全新安装 10.0.2 或从 10.0.1 升级。我总是遇到这样的错误,显然无法访问文件夹。

Packages directory here \Newtonsoft.Json.10.0.2\lib\net20\Newtonsoft.Json.xml could not be found in your workspace, or you do not have permission to access it.

如果我检查包目录,我确实只有一个 10.0.1 文件夹,即使是全新安装。

编辑:如果我在目录中打开资源管理器 window,并在 "upgrade" 期间不断按 F5,我可以看到创建了一个 10.0.2 文件夹。一旦升级失败,它就会被删除。

Edit2:这是否与 TFS 有某种关系?

这看起来像这个问题:

TFS Error "[file]not be found in your workspace, or you do not have permission to access it" during upgrade or uninstall when solution/project is bound to TFS source control

the bug is during uninstalling packages, nuget will delete package files from TFS, but if user set disableSourceControllntegration to true, package files are not added to TFS workplace during installing, so TFS can't find those files during uninstalling. (sic)

修复方法是安装最新版本的 nuget.exe(3.5 或更高版本),您可以找到 here