I’m trying to build a project for Windows Phone using Json.net . This is what I got.
Error building Player: Exception: Failed to run reference rewriter with command “–target=“Temp/StagingArea\Newtonsoft.Json.dll” --framework=“C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\WindowsPhone\v8.0,C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Libraries,C:\Program Files (x86)\Unity\Editor\Data\PlaybackEngines\wp8support\Players\ARM\master” --platform=“C:\Program Files (x86)\Windows Phone Kits\8.0\Windows MetaData\Windows.winmd” --support=“Temp\StagingArea\WinRTLegacy.dll” --supportpartialns=Unity.Partial --winmdrefs=”" --system=System --dbg=pdb --alt=System.Net ;System.Net.Sockets,System.Net ;System.Xml.Serialization;System.ComponentModel,System.Windows;System.Threading,mscorlib". [Temp/StagingArea\Newtonsoft.Json.dll]
Error: type System.Runtime.Serialization.SerializationInfo
doesn’t exist in target framework. It is referenced from Newtonsoft.Json.dll at System.Void Newtonsoft.Json.JsonException::.ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext).
Error: type System.Runtime.Serialization.SerializationInfo
doesn’t exist in target framework. It is referenced from Newtonsoft.Json.dll at System.Void Newtonsoft.Json.JsonException::.ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext).
Error: method System.Void System.Exception::.ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)
doesn’t exist in target framework. It is referenced from Newtonsoft.Json.dll at System.Void Newtonsoft.Json.JsonException::.ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext).
Error: type System.Diagnostics.TraceLevel
doesn’t exist in target framework. It is referenced from Newtonsoft.Json.dll at Newtonsoft.Json.Serialization.ITraceWriter.
Error: type System.Diagnostics.TraceLevel
doesn’t exist in target framework. It is referenced from Newtonsoft.Json.dll at System.Diagnostics.TraceLevel Newtonsoft.Json.Serialization.ITraceWriter::get_LevelFilter().
Error: type System.Diagnostics.TraceLevel
doesn’t exist in target framework. It is referenced from Newtonsoft.Json.dll at System.Void Newtonsoft.Json.Serialization.ITraceWriter::Trace(System.Diagnostics.TraceLevel,System.String,System.Exception).
Error: type System.Diagnostics.TraceLevel
doesn’t exist in target framework. It is referenced from Newtonsoft.Json.dll at Newtonsoft.Json.Serialization.DiagnosticsTraceWriter.
Error: type System.Diagnostics.TraceLevel
doesn’t exist in target framework. It is referenced from Newtonsoft.Json.dll at Newtonsoft.Json.Serialization.DiagnosticsTraceWriter.
Error: type System.Diagnostics.TraceLevel
doesn’t exist in target framework. It is referenced from Newtonsoft.Json.dll at System.Diagnostics.TraceLevel Newtonsoft.Json.Serialization.DiagnosticsTraceWriter::get_LevelFilter().
Error: type System.Diagnostics.TraceLevel
doesn’t exist in target framework. It is referenced from Newtonsoft.Json.dll at System.Diagnostics.TraceLevel Newtonsoft.Json.Serialization.DiagnosticsTraceWriter::get_LevelFilter().
Error: type System.Diagnostics.TraceLevel
doesn’t exist in target framework. It is referenced from Newtonsoft.Json.dll at System.Diagnostics.TraceLevel Newtonsoft.Json.Serialization.DiagnosticsTraceWriter::get_LevelFilter().
Error: type System.Diagnostics.TraceLevel
doesn’t exist in target framework. It is referenced from Newtonsoft.Json.dll at System.Void Newtonsoft.Json.Serialization.DiagnosticsTraceWriter::set_LevelFilter(System.Diagnostics.TraceLevel).
Error: type System.Diagnostics.TraceLevel
doesn’t exist in target framework. It is referenced from Newtonsoft.Json.dll at System.Void Newtonsoft.Json.Serialization.DiagnosticsTraceWriter::set_LevelFilter(System.Diagnostics.TraceLevel).
Error: type System.Diagnostics.TraceEventType
doesn’t exist in target framework. It is reference
I have downloaded the latest source of Json.net from here,
Releases · JamesNK/Newtonsoft.Json · GitHub ,
opened the solution with VS2013, added UnityEngine.dll to the references and built the project targeting .net2.0. The app runs fine in the editor. And according to this page, Introduction , Json.net supports WP8.
Any advice is well appreciated. Thanks in advance.
Build project for WP8 specifically, this will give you compilations errors for all unsupported APIs.
1 Like
The other thing you can do is to put your .NET 2.0 / 3.5 version in an /Editor special folder and download the official release and put it in a folder for WP8. I think that may work, though I’m not positive. What you’ll run into is that there are two compilation passes that happen here. The first one is in the editor itself so you have to have a version of JSON .NET that works in the editor and the second pass is the Windows build (Universal, Store, Phone 8.1 etc) so you’ll have to have the Windows specific version for that. I tackled this in my port by using compiler directives to make sure only the relevant portions build in the right scenario.