Failed to add reference to 'Newtonsoft.Json

2020-03-17 02:54发布

I just installed Windows 8 on my PC and downloaded Microsoft Visual Studio Express 2012 for Windows 8. Updated and everything, and when I try to install anything thru Package Manager Console, I get following error:

PM> Install-Package Parse
Attempting to resolve dependency 'Newtonsoft.Json (≥ 4.5.9)'.
Successfully installed 'Newtonsoft.Json 4.5.11'.
Successfully installed 'parse 1.0.5'.
Successfully uninstalled 'Newtonsoft.Json 4.5.11'.
Install failed. Rolling back...
Install-Package : Failed to add reference to 'Newtonsoft.Json'.
At line:1 char:1
+ Install-Package Parse
+ ~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], InvalidOperationException
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand

Does anyone know how to fix this error?

Thanks, Jack

2条回答
家丑人穷心不美
2楼-- · 2020-03-17 03:37

Check if you already have Newtonsoft.Json reference added in packages.config. If yes, delete Newtonsoft.Json entry and retry Install-Package.

查看更多
手持菜刀,她持情操
3楼-- · 2020-03-17 03:56

Sometimes just removing it from packages.config might not be enough. I had to remove the Newtonsoft.Json directory from the packages-directory, after that installing worked.

查看更多
登录 后发表回答