views:

423

answers:

5

Does anyone know, or have a link to an article or a step by step tutorial, that would tell me how to distribute a .net MONO application with a minimum install? The full package of Mono is like 75 MB but I know al lot of that is the compiler and libraries that I don't need.

I just want the minimum runtime files.

What files would I need to distribute for a simple 'Hello World' winforms app?

I tried just deleting files until I came up with something that worked but it only worked on the machine that had Mono installed on it. Here are the files I tried

I created a directory for my app. In that directory I created two more directories

\bin \lib\mono\2.0

in the \mono\lib\mono\2.0 I put the mscorlib.dll file in the \bin directory I put the following

Accessibility.dll,MyApp.exe (this is the basic Hello World I did in VS2005),iconv.dll, intl.dll, libglib-2.0-0.dll, libgthread-2.0-0.dll, Microsoft.VisualBasic.dll, mono.dll, mono.exe, Mono.Posix.dll, System.dll, System.Drawing.dll, System.Windows.Forms.dll

Then, from the \bin directory I ran 'mono MyApp.exe' and it worked on my Mono installed machine but no others.

What I'd prefer is an 'xcopy' solution where there would be no actual installation necessary but just need the runtime files included (like when you run from a thumb drive)

Please note that this is to run on a Windows computer, not a linux box.

+2  A: 

You need to use "mkbundle" to create a self-contained executable file that can be used in a Windows environment. The end-result is an executable that contains all of the Mono libraries you need, and none of the ones you don't.

Look for the "bundles" heading on this webpage. It should get you going. Note that this is for pure Mono apps; it doesn't handle external dependencies like GTK.

EDIT BEGINS HERE

NOTE: From the mkbundle man page...

Windows

On Windows systems, it it necessary to have Unix-like toolchain to be installed for mkbundle to work. You can use cygwin's and install gcc, gcc-mingw and as packages.

Note that the binutils package contains as.

cygwin can be found here. (I install it on all my Windows machines and highly recommend it.) Note also that cygwin is only required on the dev machine. It does not need to be deployed to the target(s).

JPLemme
+1  A: 

I tried running mkbundle2 (it is a .net 2.0 app) and got this error

C:\Program Files\Mono-2.0.1\bin>mkbundle2 C:\Projects\SingleExeTest\bin\Release\SingleExeTest.exe --deps OS is: Windows Sources: 1 Auto-dependencies: True embedding: C:\Projects\SingleExeTest\bin\Release\SingleExeTest.exe embedding: C:\PROGRA~1\MONO-2~1.1\lib\mono\2.0\mscorlib.dll embedding: C:\PROGRA~1\MONO-2~1.1\lib\mono\2.0\Microsoft.VisualBasic.dll embedding: C:\PROGRA~1\MONO-2~1.1\lib\mono\2.0\System.dll embedding: C:\PROGRA~1\MONO-2~1.1\lib\mono\2.0\System.Configuration.dll embedding: C:\PROGRA~1\MONO-2~1.1\lib\mono\2.0\System.Xml.dll embedding: C:\PROGRA~1\MONO-2~1.1\lib\mono\2.0\System.Security.dll embedding: C:\PROGRA~1\MONO-2~1.1\lib\mono\2.0\Mono.Security.dll embedding: C:\PROGRA~1\MONO-2~1.1\lib\mono\2.0\System.Windows.Forms.dll embedding: C:\PROGRA~1\MONO-2~1.1\lib\mono\2.0\System.Drawing.dll embedding: C:\PROGRA~1\MONO-2~1.1\lib\mono\2.0\System.Data.dll embedding: C:\PROGRA~1\MONO-2~1.1\lib\mono\2.0\Mono.Data.Tds.dll embedding: C:\PROGRA~1\MONO-2~1.1\lib\mono\2.0\System.Transactions.dll embedding: C:\PROGRA~1\MONO-2~1.1\lib\mono\2.0\System.EnterpriseServices.dll embedding: C:\PROGRA~1\MONO-2~1.1\lib\mono\2.0\Mono.WebBrowser.dll embedding: C:\PROGRA~1\MONO-2~1.1\lib\mono\2.0\Mono.Posix.dll embedding: C:\PROGRA~1\MONO-2~1.1\lib\mono\2.0\Accessibility.dll Compiling: as -o temp.o temp.s

Unhandled Exception: System.ComponentModel.Win32Exception: ApplicationName='sh', CommandLine='-c "as -o temp.o temp.s "', CurrentDirectory='' at System.Diagnostics.Process.Start_noshell (System.Diagnostics.ProcessStartIn fo startInfo, System.Diagnostics.Process process) [0x00000] at System.Diagnostics.Process.Start_common (System.Diagnostics.ProcessStartInf o startInfo, System.Diagnostics.Process process) [0x00000] at System.Diagnostics.Process.Start (System.Diagnostics.ProcessStartInfo start Info) [0x00000] at MakeBundle.Execute (System.String cmdLine) [0x00000] at MakeBundle.GenerateBundles (System.Collections.ArrayList files) [0x00000] at MakeBundle.Main (System.String[] args) [0x00000]

C:\Program Files\Mono-2.0.1\bin>

Any suggestions?

+1  A: 

what is the 'as' package called? I installed the gcc and gcc-mingw but I can't find the 'as'

Thanks again

+1  A: 

Hey, looks like I got it working!

I had to install Mono in c:\mono instead of c:\program files\mono

I guess it didn't like the spaces

Thanks for all you help!

A: 

I had to install Mono in c:\mono instead of c:\program files\mono

I guess it didn't like the spaces

Simply use "" to quote the path.