我从模板中创建了一个全新的C#Web应用程序,并立即更新了所有NuGet包。
在更新过程中,它需要重新启动,之后,它会继续显示此消息:
无法完全卸载一个或多个软件包: Newtonsoft.Json.6.0.4。重新启动Visual Studio以完成卸载。
但重启Visual Studio后仍然存在相同的消息。
packages.config 文件包含以下行:<package id="Newtonsoft.Json" version="6.0.4" targetFramework="net452" />
。
答案 0 :(得分:1)
尝试在程序包管理器控制台中手动更新程序包后,我收到一条错误消息,指出现有文件阻止了安装。从解决方案包中删除相应的文件夹后,错误消失了,我可以直接从包管理器UI更新包。
这是我的控制台打印:
PM> update-package -reinstall Newtonsoft.Json
Removing 'Newtonsoft.Json 6.0.4' from MyProject.
Successfully removed 'Newtonsoft.Json 6.0.4' from MyProject.
Uninstalling 'Newtonsoft.Json 6.0.4'.
update-package : TF400024: The change on D:\Users\Shimmy\Documents\Visual Studio
2012\Projects\MyProject\MyProject\packages\Newtonsoft.Json.6.0.4\lib\portable-net40+sl5+wp80+win8+wpa81\Newtonsoft.Json.dll cannot be undone because a file already
exists at D:\Users\Shimmy\Documents\Visual Studio
2012\Projects\MyProject\MyProject\packages\Newtonsoft.Json.6.0.4\lib\portable-net40+sl5+wp80+win8+wpa81\Newtonsoft.Json.dll. The file must be deleted from disk for
the undo to succeed.
At line:1 char:1
+ update-package -reinstall Newtonsoft.Json
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Update-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.UpdatePackageCommand
'Newtonsoft.Json 6.0.4' already installed.
Adding 'Newtonsoft.Json 6.0.4' to MyProject.
Successfully added 'Newtonsoft.Json 6.0.4' to MyProject.
One or more packages could not be completely uninstalled: Newtonsoft.Json.6.0.4. Restart Visual Studio to finish uninstall.