[Mono-list] Running an assembly in Windows

A Rafael D Teixeira rafael.teixeirabr@terra.com.br
Thu, 22 Apr 2004 10:57:56 -0300


Answers inlined:

On Wed, 2004-04-21 at 19:56, Jared Blake wrote:
> I have a project that I built with MonoDevelop and then compiled using
>  
> mcs -r:gtk-sharp,glade-sharp Main.cs -resource:gui.glade
>  
> The assembly runs perfectly on Linux but when I bring it over to my
> Windows XP box that has .NET on it, I get a System.IO.FileNotFound
> exception. 

Well you've have to install GTK# first, as you are using it in your
program. In CLI programming (Mono, .NET, etc..) as in Java, libraries
can't be statically linked to your application, so if you use any that
is not part of the basic class libraries you have to distribute it with
your application or require that it be installed for global use first.

> I tried putting the gtk-sharp.dll and glade-sharp.dll into my .NET
> framework but I still get the error. 

It's not enough! The GTK# installer puts the assemblies in the GAC so
that all applications can use it, also it installs the GTK for Windows
DLLs (remember GTK# is a managed wrapper for GTK).

> Is it possible to compile a program with mono and bring it over to a
> Windows machine that has .NET installed on it and run the assembly
> without doing anything special?

As long as you don't use libraries not distributed with .NET or that you
distribute all your dependencies with your programs. You just mixed
things, by using non-.NET libraries in your application. For example if
you do a console app that only uses the System.* libraries it should
work in both platforms equally well, except for things like the
respectives filesystems's case-sensitiveness and hierarchies
differences, that you can code carefully to avoid having trouble with.

>  
> Thanks,
> Jared Blake
> jared@wingateweb.com
> Software Engineer

You're welcome Jared,

Good Developments,
-- 
Rafael "Monoman" Teixeira 
Mono Hacker since 16 Jul 2001 - http://www.go-mono.org/
Mono Brasil Founding Member - http://monobrasil.redesolbrasil.org/
English Blog: http://monoblog.blogspot.com/
Brazilian Portuguese Blog: http://monoblog.weblogger.terra.com.br/