[Mono-dev] Gtk depends on Winforms ¿?

Christian Hoff christian_hoff at gmx.net
Sat Sep 5 03:15:47 EDT 2009

Andoni Morales wrote:
> Hi,
> I have recently tried to upgrade  from Mono 2.4 to in Windows
> XP, which comes with gtk-sharp-2.12.9
> In Windows I use 'mkbundle' [1] to generate from my c# app an
> executable file that can be launched on a computer that doesn't not
> have mono installed. mkbundle builds a new executable that embeds all
> the assemblies needed by the c# executable to run.(I attach the
> output)
> My aplication does not depends on Winforms and using Mono 2.4 I can
> launch it without any problems. But  when I use Mono I run
> into this exception:
>  Unhandled Exception: System.TypeInitializationException: An exception
> was thrown by the type initializer for Gtk.Application --->
> System.IO.FileNotFoundException: Could not load file or assembly
> 'System.Windows.Forms, Version=, Culture=neutral,
> PublicKeyToken=b77a5c561934e089' or one of its dependencies. The
> system cannot find the file specified.
> File name: 'System.Windows.Forms, Version=, Culture=neutral,
> PublicKeyToken=b77a5c561934e089'
> Does that means that with gtk-sharp-2.12.9 I need System.Windows.Forms
> to run a Gtk app? Why does Gtk.Application has a runtime dependency on
> System.Windows.Forms and why mkbundle is not even aware of this
> dependency and does not include this assembly in the bundle?
> It also happens with so I believe it's a gtk-sharp issue
You're right. gtk-sharp has a Winforms dependency on the Windows 
platform to enable visual styles by calling 
System.Windows.Forms.Application.DoEvents via reflection. Nobody has 
ever found out why this works or how we could implement such 
functionality without loading winforms.

We should probably put that code in a try-block. What do you think, Mike?


More information about the Mono-devel-list mailing list