问题描述
我有一个使用JSON.NET 4.0.2的Windows Phone 7.1(Mango)应用程序.
我将其升级到4.0.3,现在出现各种错误.
以前工作过的反序列化类现在抛出此错误:无法从程序集"System.Core,版本= 3.7.0.0,区域性=中性,PublicKeyToken = 969DB8053D3322AC"中加载类型"System.Dynamic.IDynamicMetaObjectProvider".
我还通过使用JArray来使用Linq功能,现在我收到以下消息:{无法从程序集"Newtonsoft.Json,版本= 4.0.3.0,文化=中性,PublicKeyToken = 30AD4FE6B2A6AEED"中加载程序集"Newtonsoft.Json.Linq.JArray"."}
我尝试清洁溶液.我尝试再复制一次DLL.
有什么建议吗?
问题是,如果未指定显式的Silverlight 4 WP构建,则Windows Phone 7.1默认为Silverlight 4构建. Silverlight 4具有WP上不可用的功能,这就是为什么这会导致Json.NET中断的原因.
此问题将在4.0.5中通过使用当前的Windows Phone 7.0 dll用于7.1来解决,但现在要解决此问题,只需将dll引用更改为sl3-wp目录中的Newtonsoft.Json.dll文件. /p>
I have a Windows Phone 7.1 (Mango) application that was using JSON.NET 4.0.2.
I upgraded it to 4.0.3 and now I get all kinds of error.
A deserialized class that was working before is now throwing this error :Could not load type 'System.Dynamic.IDynamicMetaObjectProvider' from assembly 'System.Core, Version=3.7.0.0, Culture=neutral, PublicKeyToken=969DB8053D3322AC'.
I also make use of the Linq feature by using JArray and now I get this message:{"Could not load type 'Newtonsoft.Json.Linq.JArray' from assembly 'Newtonsoft.Json, Version=4.0.3.0, Culture=neutral, PublicKeyToken=30AD4FE6B2A6AEED'."}
I tried cleaning the solution. I tried copying the DLLs one more time.
Any suggestions?
The problem is that Windows Phone 7.1 defaults to the Silverlight 4 build if no explicit Silverlight 4 WP build is specified. Silverlight 4 has features that aren't available on WP which is why this causes Json.NET to break.
This will be fixed in 4.0.5 by having the current Windows Phone 7.0 dll used for 7.1 but for now to fix the problem just change the dll reference to the Newtonsoft.Json.dll file in the sl3-wp directory.
这篇关于迁移到JSON.NET 4.0.3破坏了我的应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!