自更新 NuGet 包以来,VS 一直需要重启

VS persists requiring restart since updating NuGet packages

我从模板创建了一个全新的 C# Web 应用程序并立即更新了它的所有 NuGet 包。

更新过程中需要重启,之后一直显示:

One or more packages could not be completely uninstalled: Newtonsoft.Json.6.0.4. Restart Visual Studio to finish uninstall.

但重新启动后仍然存在相同的消息Visual Studio。

packages.config 文件包含以下行:<package id="Newtonsoft.Json" version="6.0.4" targetFramework="net452" />.

尝试在包管理器控制台中手动更新包后,我收到一条错误消息,指出现有文件正在阻止安装。从解决方案包中删除适当的文件夹后,错误消失了,我可以直接从包管理器更新包 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.