[Gtk-sharp-list] Embeded File does not work with glade in windows?

Peter Johanson peter at peterjohanson.com
Thu Nov 30 17:30:09 EST 2006


On Thu, Nov 30, 2006 at 08:15:40PM -0200, Carlos Adriano Portes wrote:
> I am using visual studio 2003 to develop an aplication, I used glade 3
> to develop my ui but when I execute the following code I get the
> following error:
> 
> code:
> 
> frmPrincipal = new XML(this.GetType().Assembly,
> "HegloTransportes.glade", "FormPrincipal", null);
> 			frmPrincipal.Autoconnect(this);
> 
> error:
> 
> Cannot get resource file 'HegloTransportes.glade'
> 
> Ok the name of the file is correct, the file is set to be compiled as
> a resource file, there is nothing more that I remember, could someone
> point out the problem?

Sadly, csc/VS name embedded resources including some funky combination
of directories or somesuch in the resource name when including them. If
you use monodis or ildasm on the generated assembly, you can see that
the resource name isn't simply 'HegloTransportes.glade' on windows, but
probably 'some/path/to/HegloTransportes.glade'. Most of the time you can
get around this by making some helper method to trim off path names from
strings before passing them to the Glade.XML methods.

-pete


More information about the Gtk-sharp-list mailing list