Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/264.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何通过nuget for windows phone 7.1和Silverlight v.4,0正确安装Json.net_C#_Silverlight_Json.net_Windows Phone 7.1 - Fatal编程技术网

C# 如何通过nuget for windows phone 7.1和Silverlight v.4,0正确安装Json.net

C# 如何通过nuget for windows phone 7.1和Silverlight v.4,0正确安装Json.net,c#,silverlight,json.net,windows-phone-7.1,C#,Silverlight,Json.net,Windows Phone 7.1,我需要使用json.net进行json序列化和反序列化,但我在安装这个包时遇到了问题。正如我在上看到的,它支持wp 7.1和silverilight。当我在控制台中键入时安装软件包Newtonsoft.Json Installing 'Newtonsoft.Json 6.0.1'. Successfully installed 'Newtonsoft.Json 6.0.1'. Adding 'Newtonsoft.Json 6.0.1' to Connected. Uninstalling 'N

我需要使用json.net进行json序列化和反序列化,但我在安装这个包时遇到了问题。正如我在上看到的,它支持wp 7.1和silverilight。当我在控制台中键入时
安装软件包Newtonsoft.Json

Installing 'Newtonsoft.Json 6.0.1'.
Successfully installed 'Newtonsoft.Json 6.0.1'.
Adding 'Newtonsoft.Json 6.0.1' to Connected.
Uninstalling 'Newtonsoft.Json 6.0.1'.
Successfully uninstalled 'Newtonsoft.Json 6.0.1'.
Install failed. Rolling back...
Install-Package : Could not install package 'Newtonsoft.Json 6.0.1'. You are trying to install this package into a project tha
t targets 'Silverlight,Version=v4.0,Profile=WindowsPhone71', but the package does not contain any assembly references or conte
nt 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
如何解决这个问题?
如何正确地完成它?

对于windows phone 7,您可能应该安装该软件包的旧版本,例如5.0.1。您可以安装软件包Newtonsoft.Json-version 5.0.1

右键单击dll,在常规选项卡的安全部分

然后打开它

感谢:

Json.Net已改为针对Windows Phone 8和Silverlight 5,而不是针对.Net 4便携版的WP7和SL4。上一个以WP7和SL4为目标的Json.Net版本是我试图添加对Newtonsoft.Json.dll的引用,但对于每个文件,我都会收到错误“无法将对更高版本或不兼容程序集的引用添加到项目中”。我先下载5.0.8并尝试使用每个文件,然后在这里使用5.0.1,对于4.5.11,我将此dll添加到项目中的方式有什么问题。我应该怎么做才能让它为我工作?+1与windows phone 8.1应用程序有着同样的问题-所以这与windows 7无关