I'm not having much luck embedding Mono into a Xamarin.Mac application.
If I select "Don't Link", then everything works great but the package ends up bigger than I'd like. I'd really like to link at least the Framework SDKs.
First Problem, not all assemblies added to mmp command when "Link Framework SDK's Only" chosen
My Solution looks like
MonoGame project
-- references Tao.Sdl.dll
MyLib project
MyGame project
Here when mmp runs, Tao.Sdl.dll is not added to the list of assemblies, so mmp errors out with
error MM2002: Failed to resolve "System.Int32 Tao.Sdl.Sdl.::SDL_JoystickNumAxes(System.IntPtr)
I worked around this by running mmp myself as a custom command and adding Tao.Sdl.dll to the arguments. By doing this, I am able to get everything built and the installer package made.
Second problem, getting System.TypeInitializationException at runtime
It seems like mmp is stripping out too much or is not familiar with static constructors. We are using System.Web.Script.Serialization.JavaScriptSerializer, which has a static constructor. At runtime I get this:
Unhandled Exception:
System.TypeInitializationException: An exception was thrown by the type initializer for Fusion.Jason ---> System.TypeInitializationException: An exception was thrown by the type initializer for System.Web.Script.Serialization.JavaScriptSerializer ---> System.Configuration.ConfigurationErrorsException: Type 'System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' not found.
at System.Configuration.InternalConfigurationHost.GetConfigType (System.String typeName, Boolean throwOnError) [0x00000] in <filename unknown>:0
at System.Configuration.ConfigInfo.CreateInstance () [0x00000] in <filename unknown>:0
at System.Configuration.Configuration.GetSectionGroupInstance (System.Configuration.SectionGroupInfo group) [0x00000] in <filename unknown>:0
at System.Configuration.ConfigurationSectionGroupCollection.get_Item (System.String name) [0x00000] in <filename unknown>:0
at System.Configuration.Configuration.GetSection (System.String path) [0x00000] in <filename unknown>:0
at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection (System.String configKey) [0x00000] in <filename unknown>:0
at System.Configuration.ConfigurationManager.GetSection (System.String sectionName) [0x00000] in <filename unknown>:0
at System.Web.Script.Serialization.JavaScriptSerializer..ctor (System.Web.Script.Serialization.JavaScriptTypeResolver resolver, Boolean registerConverters) [0x00000] in <filename unknown>:0
at System.Web.Script.Serialization.JavaScriptSerializer..cctor () [0x00000] in <filename unknown>:0