[Mono-list] Compiling statically

Paolo Molaro lupus@ximian.com
Mon, 27 Jan 2003 17:46:49 +0100

On 01/28/03 Alan Tam wrote:
> May I know if there is a way to compile .cs files statically in Windows and
> then run it in Mono, so that it would run in some UNIX, but irrespective of
> the mono assemblies?

Short answer: no.
Long answer: it wold be an easy and interesting hack to add the
following feature to the mono runtime:
1) support for loading assemblies from a byte array (this is needed
anyway to implement some reflection features): I now someone already did
this, but didn't post patches: it should be quite easy to do.
2) change the build scripts to embed the needed assemblies _inside_
the mono binary.
3) make the runtime load corlib and any other needed assembly from
within itself.

At this point you'll have a single (big) mono binary that can run your app.
Reducing the size of the included assemblies (by removing unused methods
and types) as well as all the rest is left as an exercise for the


lupus@debian.org                                     debian/rules
lupus@ximian.com                             Monkeys do it better