[Mono-dev] Application deployment questions

Robert Jordan robertj at gmx.net
Thu Aug 24 04:50:26 EDT 2006


Lucifer wrote:
> Hi everyone,
> 
> I have read this article though sill not quite understand how to do it.
> http://www.mono-project.com/Guidelines:Application_Deployment
> 
> The normal way to run an application compiled with Mono would be to invoke
> it through the Mono runtime, like this: mono myprogram.exe
> However, I have to deploy my application to end users that are not supposed
> to have Mono runtime/libs installed.
> 
> What's the best practice for deployment?
> 
> I'm planning on packing my application EXE with required DLLs such as
> intl.dll, libglib-2.0-0.dll, mono-1.dll, etc., and the mono.exe.
> Is it a feasible way to do?

All *.dlls from Mono's bin folder are needed, unless you
can prove that your app doesn't touch one of them.

You should build the following hierarchy:

yourapp\
yourapp\bin\yourapp.exe
yourapp\bin\mono.exe
yourapp\bin\*.dll
yourapp\etc\mono\  copied from $monoprefix\etc\mono
yourapp\lib\mono\  copied from $monoprefix\lib\mono


> Would it be a better way if I embed Mono runtime(mono.exe) in my
> application?

Not w/out duplicating mkbundle's work.

> http://www.mono-project.com/Embedding_Mono
> In addition, I checked out mkbundle.exe to realize that it is for Linux only
> that is unable to use it for Win32 or MacOSX.

Mkbundle as of Mono 1.1.14 works in Windows.

Under MacOS just some settings are missing. Use the following
shell script:

---cut-here---
#!/bin/bash

PKG_CONFIG_PATH=/Library/Frameworks/Mono.framework/Libraries/pkgconfig
DYLD_LIBRARY_PATH=/Library/Frameworks/Mono.framework/Libraries

export PKG_CONFIG_PATH DYLD_LIBRARY_PATH

mkbundle $*
---cut-here---


> Second question:
> While Mono.exe startup, it would search '\mono\2.0\' path for 'mscorlib.dll'
> even if I write code such as: mono_set_dirs("", "") to change its search
> path.
> I tried to place 'mscorlib.dll' in the same directory with my application
> EXE but it's not worked and the assembly can't be found.
> How could I do it right?

With mono_set_dirs("", "") you'd need the following directory
structure:

yourapp.exe
mono\

The contents of "mono" must be built by copying (recursive) the
contents of the following folders:

$monoprefix\etc\mono\*
$monoprefix\lib\mono\*

It would be much saner from maintainer's point of view
to build this hierarchy:

yourapp.exe
etc\mono   <- copied from  $monoprefix\etc\mono
lib\mono   <- copied from  $monoprefix\lib\mono

and call mono_set_dirs("lib", "etc");

You should make "lib" and "etc" absolute.

Robert




More information about the Mono-devel-list mailing list