[Mono-osx] Deploying a Mono app on mac without dependencies

Tim Martin tim at asymptotic.co.uk
Thu Jul 22 09:53:55 EDT 2010


Hi,

I've been trying to deploy a Mono app on Mac such that users don't have 
to install Mono to run it. The app runs fine on the dev box that has 
Mono installed. I've created a .app package and copied all the 
referenced .dylib files into the Resources directory, and I've modified 
the paths on the executable and .dylib files to point to relative paths. 
However, when I run the app on a box without Mono it bombs out with:

Unhandled Exception: System.TypeInitializationException: An exception
was thrown by the type initializer for
System.Windows.Forms.WindowsFormsSynchronizationContext --->
System.TypeInitializationException: An exception was thrown by the type
initializer for System.Windows.Forms.ThemeEngine --->
System.TypeInitializationException: An exception was thrown by the type
initializer for System.Windows.Forms.ThemeWin32Classic --->
System.TypeInitializationException: An exception was thrown by the type
initializer for System.Drawing.KnownColors --->
System.TypeInitializationException: An exception was thrown by the type
initializer for System.Drawing.GDIPlus --->  System.DllNotFoundException:
/Library/Frameworks/Mono.framework/Versions/2.6.4/lib/libgdiplus.dylib
   at (wrapper managed-to-native) System.Drawing.GDIPlus:GdiplusStartup
   (ulong&,System.Drawing.GdiplusStartupInput&,System.Drawing.GdiplusStartupOutput&)
   at System.Drawing.GDIPlus..cctor () [0x00000] in<filename unknown>:0
   --- End of inner exception stack trace ---
   at System.Drawing.KnownColors..cctor () [0x00000] in<filename
   unknown>:0
   --- End of inner exception stack trace ---
   at System.Drawing.Color.get_Black () [0x00000] in<filename unknown>:0
   at System.Windows.Forms.ThemeWin32Classic..cctor () [0x00000] in
   <filename unknown>:0
   --- End of inner exception stack trace ---
   at System.Windows.Forms.ThemeVisualStyles..ctor () [0x00000] in
   <filename unknown>:0
   at System.Windows.Forms.ThemeEngine..cctor () [0x00000] in<filename
   unknown>:0
   --- End of inner exception stack trace ---
   at System.Windows.Forms.SystemInformation.get_MenuAccessKeysUnderlined
   () [0x00000] in<filename unknown>:0
   at System.Windows.Forms.Control..ctor () [0x00000] in<filename
   unknown>:0
   at (wrapper remoting-invoke-with-check)
   System.Windows.Forms.Control:.ctor ()
   at System.Windows.Forms.WindowsFormsSynchronizationContext..cctor ()
   [0x00000] in<filename unknown>:0
   --- End of inner exception stack trace ---
   at System.Windows.Forms.Control..ctor () [0x00000] in<filename
   unknown>:0
   at System.Windows.Forms.ScrollableControl..ctor () [0x00000] in
   <filename unknown>:0
   at System.Windows.Forms.ContainerControl..ctor () [0x00000] in
   <filename unknown>:0
   at System.Windows.Forms.Form..ctor () [0x00000] in<filename
   unknown>:0
   at Psonar.Desktop.Forms.MainForm..ctor () [0x00000] in<filename
   unknown>:0
   at (wrapper remoting-invoke-with-check)
   Psonar.Desktop.Forms.MainForm:.ctor ()
   at Psonar.Desktop.Forms.AppContext..ctor () [0x00000] in<filename
   unknown>:0
   at Psonar.Desktop.Forms.Program.Main (System.String[] args) [0x00000]
   in<filename unknown>:0


The obvious conclusion is that it's trying to load libgdiplus.dylib, but 
I don't see how to change the search path for that library, since it 
isn't listed in otool -L output for the executable. I'm afraid I'm very 
new to Mac OS programming and totally stuck at this point.

Any suggestions appreciated,

Tim


More information about the Mono-osx mailing list