JSON.Net在构建时抛出异常

时间:2014-07-29 09:09:52

标签: c# windows-phone-7 json.net

我使用WebClient.DownloadStringAsync()下载JSON字符串,并使用Json.Net的JObject.Parse()将该字符串解析为JSON对象,以便我可以使用LINQ查询该对象。但是当我尝试构建解决方案时,它会抛出异常并发出警告

Reference to type 'System.Func`2' claims it is defined in 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0\Profile\WindowsPhone71\mscorlib.dll', but it could not be found

使用这些包:

using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using Newtonsoft.Json; //v 6.0.3
using Newtonsoft.Json.Linq;
using System.Runtime.Serialization;

1 个答案:

答案 0 :(得分:0)

见其他答案:how to properly install Json.net via nuget for windows phone 7.1 and Silverlight v.4,0

当你在WP8之前定位Windows Phone版本时,你应该使用旧版本的Newtonsoft.Json。

您可以Install-package Newtonsoft.Json -version 5.0.8获取版本5.0.8,但之前删除6.0.3版本。