How to make a DLL work with Unity in Mac OS X?

I’ve designed an application in which the user must register himself. For this I’ve used a Web Service, and the application running in the Unity Editor on Mac OS X, or Windows makes the request without errors.

If I build the application as a Windows executable it also works, but when I build the application for Mac OS X it no longer works (outside the Editor). The request does not work properly.

In the project I’ve created Plugins folder and introduced both System.Web and System.Web.Services DLLs.

Api Compability Level in Player Settings is NET 2.0.

When I try to run the Mac OS X build I get this error message in the Log:

at System.Net.WebRequest.GetCreator (System.String prefix) [0x00000] in <filename unknown>:0 
  at System.Net.WebRequest.Create (System.Uri requestUri) [0x00000] in <filename unknown>:0 
  at System.Web.Services.Protocols.WebClientProtocol.GetWebRequest (System.Uri uri) [0x00000] in <filename unknown>:0 
  at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebRequest (System.Uri uri) [0x00000] in <filename unknown>:0 
  at System.Web.Services.Protocols.SoapHttpClientProtocol.GetWebRequest (System.Uri uri) [0x00000] in <filename unknown>:0 
  at System.Web.Services.Protocols.SoapHttpClientProtocol.GetRequestForMessage (System.Uri uri, System.Web.Services.Protocols.SoapClientMessage message) [0x00000] in <filename unknown>:0 
  at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke (System.String method_name, System.Object[] parameters) [0x00000] in <filename unknown>:0 
  at BGWebServiceService.login (.LoginRequestBean bean) [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) BGWebServiceService:login (LoginRequestBean)
  at ClientObject.loginAsyncRequest () [0x00000] in <filename unknown>:0 

I’ve looked many forums and searched the web and I can’t find the answer. I don´t know if it´s necessary to add any other folder, put the DLLs on some other place or do something else in the project.

Any help would be very appreciated.

Thank you.

I have found how to make it work.

Only, we have to add /Applications/Unity/Unity.app/Contents/Frameworks/Mono folder into our Framework´s app folder.

IIRC Unity doesn’t include the dependencies of your .net libraries automatically in the builds. If you library depends on some .net standard assemblies then you need to add those to the Plugins folder as well (from /Applications/Unity/Unity.app/Contents/Frameworks/Mono/lib/mono and the appropriate subdirectory).

It’s also good to build your library against these libraries to avoid surprises after building your project. Especially for the mobile targets, there are classes and methods missing from those assemblies and if you don’t build against them you’ll only notice once you export and try to run your project.