Adding Service References

I have a service reference that needs to use “System.Data.Services.Client.dll” I am explicitly trying to grab data from an oData Service point and putting the data in for use in Unity. Monodevelop build/compiles perfectly and reports NO errors however unity fails to run with the below error.

I have tried to just add the reference in Monodevelop but Unity just deletes the service reference.
I read somewhere to add the DLL to the assets folder and but causes this error when I try to run.


Unhandled Exception: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.
at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool)
at System.Reflection.Assembly.GetTypes () [0x00000] in :0
at Mono.CSharp.RootNamespace.ComputeNamespaces (System.Reflection.Assembly assembly, System.Type extensionType) [0x00000] in :0
at Mono.CSharp.RootNamespace.ComputeNamespace (Mono.CSharp.CompilerContext ctx, System.Type extensionType) [0x00000] in :0
at Mono.CSharp.GlobalRootNamespace.ComputeNamespaces (Mono.CSharp.CompilerContext ctx) [0x00000] in :0
at Mono.CSharp.Driver.LoadReferences () [0x00000] in :0
at Mono.CSharp.Driver.Compile () [0x00000] in :0
at Mono.CSharp.Driver.Main (System.String args) [0x00000] in :0

I may have found my issue. In order to support the addition of System.Data.Services.Client.dll I had to go to…

File → Build Settings → Player Settings… → Other Settings → Set API Compatibility Level to .Net 2.0 and NOT the subset one.

Now I get an access denied but now my project compiles and runs.

Welp, apparently unity does not support System.Net.CredentialCache.DefaultNetworkCredentials to set credentials on a Context, but “new System.Net.NetworkCredential(“user”,“password”,“domain”);”

Worked like a charm… I guess I solved my own problem, but others may see this. I hope it helps someone!