This project has moved. For the latest updates, please go here.

Unity 3D - Build to Windows Phone 8 - Build Error

Mar 31, 2014 at 2:19 PM
Hi guys !

I got a strange error on Unity when i'm trying to build for Windows Phone 8 on Windows 8 with Unity Pro 4.3.3f1.
No errors before the Build, the error appear after the "Post Processing Player" state of the build process. Can you look at this ? :)

Thx dudes

Here the error :

Error building Player: Exception: Error: method System.Text.Encoding System.Text.Encoding::get_Default() doesn't exist in target framework. It is referenced from zxing.unity.dll at System.Void ZXing.Client.Result.VCardResultParser::maybeAppendFragment(System.IO.MemoryStream,System.String,System.Text.StringBuilder).
Error: method System.String System.Text.Encoding::GetString(System.Byte[]) doesn't exist in target framework. It is referenced from zxing.unity.dll at System.Void ZXing.Client.Result.VCardResultParser::maybeAppendFragment(System.IO.MemoryStream,System.String,System.Text.StringBuilder).
Error: method System.Text.Encoding System.Text.Encoding::get_Default() doesn't exist in target framework. It is referenced from zxing.unity.dll at System.Void ZXing.Client.Result.VCardResultParser::maybeAppendFragment(System.IO.MemoryStream,System.String,System.Text.StringBuilder).
Error: method System.String System.Text.Encoding::GetString(System.Byte[]) doesn't exist in target framework. It is referenced from zxing.unity.dll at System.Void ZXing.Client.Result.VCardResultParser::maybeAppendFragment(System.IO.MemoryStream,System.String,System.Text.StringBuilder).
Error: method System.String System.Text.Encoding::GetString(System.Byte[]) doesn't exist in target framework. It is referenced from zxing.unity.dll at System.Boolean ZXing.Datamatrix.Internal.DecodedBitStreamParser::decodeBase256Segment(ZXing.Common.BitSource,System.Text.StringBuilder,System.Collections.Generic.IList1<System.Byte[]>).
Error: type
System.Runtime.Serialization.ISerializabledoesn't exist in target framework. It is referenced from zxing.unity.dll at BigIntegerLibrary.BigInteger.
Error: type
System.Runtime.Serialization.SerializationInfodoesn't exist in target framework. It is referenced from zxing.unity.dll at System.Void BigIntegerLibrary.BigInteger::.ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext).
Error: type
System.Runtime.Serialization.SerializationInfodoesn't exist in target framework. It is referenced from zxing.unity.dll at System.Void BigIntegerLibrary.BigInteger::.ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext).
Error: method
System.Object System.Runtime.Serialization.SerializationInfo::GetValue(System.String,System.Type)doesn't exist in target framework. It is referenced from zxing.unity.dll at System.Void BigIntegerLibrary.BigInteger::.ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext).
Error: type
System.Runtime.Serialization.SerializationInfodoesn't exist in target framework. It is referenced from zxing.unity.dll at System.Void BigIntegerLibrary.BigInteger::.ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext).
Error: method
System.Object System.Runtime.Serialization.SerializationInfo::GetValue(System.String,System.Type)doesn't exist in target framework. It is referenced from zxing.unity.dll at System.Void BigIntegerLibrary.BigInteger::.ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext).
Error: type
System.Runtime.Serialization.SerializationInfodoesn't exist in target framework. It is referenced from zxing.unity.dll at System.Void BigIntegerLibrary.BigInteger::.ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext).
Error: method
System.Object System.Runtime.Serialization.SerializationInfo::GetValue(System.String,System.Type)doesn't exist in target framework. It is referenced from zxing.unity.dll at System.Void BigIntegerLibrary.BigInteger::.ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext).
Error: type
System.Runtime.Serialization.SerializationInfodoesn't exist in target framework. It is referenced from zxing.unity.dll at System.Void BigIntegerLibrary.BigInteger::GetObjectData(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext).
Error: type
System.Runtime.Serialization.SerializationInfodoesn't exist in target framework. It is referenced from zxing.unity.dll at System.Void BigIntegerLibrary.BigInteger::GetObjectData(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext).
Error: method
System.Void System.Runtime.Serialization.SerializationInfo::AddValue(System.String,System.Boolean)doesn't exist in target framework. It is referenced from zxing.unity.dll at System.Void BigIntegerLibrary.BigInteger::GetObjectData(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext).
Error: type
System.Runtime.Serialization.SerializationInfodoesn't exist in target framework. It is referenced from zxing.unity.dll at System.Void BigIntegerLibrary.BigInteger::GetObjectData(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext).
Error: method
System.Void System.Runtime.Serialization.SerializationInfo::AddValue(System.String,System.Boolean)doesn't exist in target framework. It is referenced from zxing.unity.dll at System.Void BigIntegerLibrary.BigInteger::GetObjectData(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext).
Error: type
System.Runtime.Serialization.SerializationInfodoesn't exist in target framework. It is referenced from zxing.unity.dll at System.Void BigIntegerLibrary.BigInteger::GetObjectData(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext).
Error: method
System.Void System.Runtime.Serialization.SerializationInfo::AddValue(System.String,System.Int16)doesn't exist in target framework. It is referenced from zxing.unity.dll at System.Void BigIntegerLibrary.BigInteger::GetObjectData(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext).
Error: type
System.Runtime.Serialization.SerializationInfodoesn't exist in target framework. It is referenced from zxing.unity.dll at System.Void BigIntegerLibrary.BigInteger::GetObjectData(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext).
Error: method
System.Void System.Runtime.Serialization.SerializationInfo::AddValue(System.String,System.UInt16)doesn't exist in target framework. It is referenced from zxing.unity.dll at System.Void BigIntegerLibrary.BigInteger::GetObjectData(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext).
Error: method
System.Text.Encoding System.Text.Encoding::get_Default()` doesn't exist in target framework. It is referenced from zxing.unity.dll at System.Void ZXing.Common.StringUtils::.cctor().
Coordinator
Apr 1, 2014 at 8:28 PM
For me it seems that the underlying .Net framework doesn't support all used methods on windows phone.
Perhaps you should ask that question in the unity forum to get a more professional answer?
I don't have the chance to build a testing environment. Sorry.
Apr 3, 2014 at 7:42 AM
Yesterday i've edited (and deleted) the some code of ZXing to be able to use it on Unity 3D with a Windows Phone 8 build.

Can you send me an email address to give you all the sources ? :) (if you want to fix the problem)
Coordinator
Apr 3, 2014 at 7:32 PM
Edited Apr 9, 2014 at 8:03 AM
Ofcourse, I sent you a private message.
Apr 9, 2014 at 12:26 PM
Mail sent :)

hope it will help this project and the Unity 3D community :D
Jun 10, 2014 at 3:18 PM
The problem is that Windows Phone 8 and 8.1 (probably 7.x as well) do not have a complete System.Text.Encoding implementation.

To solve this, I've written my own Portable.Text.Encoding implementation that can be used for Windows Phone development.

There's also a NuGet package available: http://www.nuget.org/packages/Portable.Text.Encoding/