2014-10-27 72 views
0

我嘗試使用命令install-package newtonsoft.json通過NuGet安裝Json.Net。將Json.Net安裝到針對Windows Phone 7的項目時出錯

我得到了如下所示的錯誤。我該如何解決這個問題?

Install-Package Newtonsoft.Json 
Installing 'Newtonsoft.Json 6.0.6'. 
Successfully installed 'Newtonsoft.Json 6.0.6'. 
Removing 'Newtonsoft.Json 6.0.3' from ReadJSON. 
Successfully removed 'Newtonsoft.Json 6.0.3' from ReadJSON. 
Adding 'Newtonsoft.Json 6.0.6' to ReadJSON. 
Uninstalling 'Newtonsoft.Json 6.0.6'. 
Successfully uninstalled 'Newtonsoft.Json 6.0.6'. 
Install failed. Rolling back... 
Install-Package : Could not install package 'Newtonsoft.Json 6.0.6'. You are trying to install this package into a project that 
targets 'Silverlight,Version=v4.0,Profile=WindowsPhone71', but the package does not contain any assembly references or content files 
that are compatible with that framework. For more information, contact the package author. 
At line:1 char:1 
+ Install-Package Newtonsoft.Json 
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    + CategoryInfo   : NotSpecified: (:) [Install-Package], InvalidOperationException 
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand 
+0

您是否嘗試聯繫軟件包作者? – 2014-10-27 14:00:08

回答

2

支持Windows Phone 7和Silverlight 4中從Json.Net在6.0版本(source)去除。如果你仍然需要定位WP7/SL4,那麼你需要使用Json.Net v5.0.8。您可以在軟件包管理器控制檯中使用以下命令來安裝此軟件:

Install-Package Newtonsoft.Json -Version 5.0.8 
相關問題