DLL Import Failed

(originally posted to wrong forum - deleted and reposted here)

Wondering if anyone has run into this:

I’ve developed a custom networing library (in visual studio, targeting .Net Framework 2.0). The library compiles and loads just fine from other MS .NET apps. The library makes a reference to the System.Net.Socket.SocketAsyncEventArgs class. Unity3d complains that it can’t load the library proberly due to a “missing or incorrect function header”. I’m assuming that this class isn’t supported in the version of Mono that Unity uses.

In preparation for Unity 3.0, I’m switching development of the library over to MonoDevelop. Is there a way I can point MonoDevelop to the Mono libraries that are included with Unity instead of the .NET libraries that are installed on my machine (which load the library just fine).

Thanks in advance!

It occurs to me that I sould include the actual error message I get when the DLL attempts to load:

TypeLoadException: Could not load type ‘System.Net.Sockets.SocketAsyncEventArgs’ from assembly ‘System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’.
System.MonoCustomAttrs.GetCustomAttributesBase (ICustomAttributeProvider obj, System.Type attributeType)
System.MonoCustomAttrs.GetCustomAttributes (ICustomAttributeProvider obj, System.Type attributeType, Boolean inherit)
System.MonoType.GetCustomAttributes (System.Type attributeType, Boolean inherit)
UnityEngine.AttributeHelperEngine.CheckIsEditorScript (System.Type klass)

InvalidProgramException: Missing or incorrect header for method BeginConnect
Client.BeginLogin (System.String name, System.String pass, Boolean newAccount)
GameMaster.Start () (at Assets\Game\GameMaster.cs:18)