Go Back   CodeCall Programming Forum > Software Development > Tutorials > CSharp Tutorials
Register Blogs Search Today's Posts Mark Forums Read

CSharp Tutorials Tutorials for C#

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-15-2009, 07:45 AM
ArekBulski's Avatar
Guru
 
Join Date: Mar 2009
Posts: 1,373
ArekBulski is just really niceArekBulski is just really niceArekBulski is just really niceArekBulski is just really niceArekBulski is just really nice
Cool Mkbundle: bundle Mono with applications

Mkbundle: bundle Mono with your applications

Did you ever wonder why you need .NET Framework or Mono installed to run your program? Well, it would be much more handy if you could distribute your applications without nagging your clients to install additional frameworks, is it not? So here we are. Lets bundle a .NET-based application with Mono, so you don't need Mono, or .NET installed to run it.

Prepare an environment

First you need to install newest Mono and Cygwin. Installing Mono is very straightforward so you cannot screw up anything. When you start installing Cygwin, go into Full view, then please include 4 additional packages. These are: gcc, mingw, mingw-zlib and zlib.

Now you need a command prompt. Both Mono and Cygwin create shortcuts for command prompts on your desktop, but you need to combine them into one. Here is a batch that does it for me. You may need to change it, if you have other Mono version for example.

Code:
echo Mono version 2.4 Build 6
echo Prepending 'C:\PROGRA~1\Mono-2.4\bin' to PATH
PATH=C:\PROGRA~1\Mono-2.4\bin;%PATH%

chdir C:\cygwin\bin
bash --login -i
Bundle an application with Mono

So we are now in a command prompt, running this Cygwin mode. Notice that this is not a DOS prompt anymore, and "dir" won't work anymore. To list files use linux command "ls". The folder you are browsing now is like the one below. Arek is a username.
Code:
C:\cygwin\home\Arek
Browse to this folder with your explorer. Now you copy 2 files into this folder. 1st is your application exe and 2nd is the file Mono.dll (2MB) that you can find in your Mono folder.
Code:
C:\Program Files\Mono-2.4\bin
For some reason the whole procedure does not work with long file names, so rename your application exe. It should comply with this old DOS 8.3 naming.

Lets go back to command prompt. You need only 1 command to bundle your application, and here is some explanation.

mkbundle is a program within Mono package | -o Bundled1.exe specifies how the Mono-bundled exe will be named | Winform1.exe says what will be included, Mono libraries will be included anyway | --deps is necessary although I am not sure what it does | -z will compress the output exe a lot

Code:
mkbundle -o Bundled1.exe Winform1.exe --deps -z
So now you got your Bundled1.exe, which contains your own app along with Mono itself. You should not need Mono nor .NET to run it. Notice that it will be 4MB or more in size. Those bundled exes are not lightweight.

Thank the author for his work

If you enjoyed reading my tutorial, please +rep me. You can also send me a cookie.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 06-15-2009, 08:15 AM
WingedPanther's Avatar
Super Moderator
 
Join Date: Jul 2006
Age: 36
Posts: 11,435
WingedPanther has much to be proud ofWingedPanther has much to be proud ofWingedPanther has much to be proud ofWingedPanther has much to be proud ofWingedPanther has much to be proud ofWingedPanther has much to be proud ofWingedPanther has much to be proud ofWingedPanther has much to be proud ofWingedPanther has much to be proud of
Re: Mkbundle: bundle Mono with applications

Very cool!

Out of curiosity, does this process create an .exe that can run in Windows, or only in Cygwin? Is there a version of Mkbundle that runs under Windows?
__________________
CodeCall Blog | CodeCall Wiki | Shareware
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 06-15-2009, 08:21 AM
Jordan's Avatar
Administrator
 
Join Date: Nov 2005
Location: Hendersonville, NC
Posts: 24,556
Jordan is a name known to allJordan is a name known to allJordan is a name known to allJordan is a name known to allJordan is a name known to allJordan is a name known to all
Send a message via ICQ to Jordan Send a message via AIM to Jordan Send a message via MSN to Jordan Send a message via Yahoo to Jordan
Re: Mkbundle: bundle Mono with applications

This was a much needed tutorial! Being able to bundle the libraries you need so the user doesn't have to install any third party software is always great. I'm guessing that if it works with Mono on Windows it will work flawlessly with Mono on Linux?

+rep

Last edited by Jordan; 06-19-2009 at 09:14 AM..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 06-15-2009, 08:32 AM
ArekBulski's Avatar
Guru
 
Join Date: Mar 2009
Posts: 1,373
ArekBulski is just really niceArekBulski is just really niceArekBulski is just really niceArekBulski is just really niceArekBulski is just really nice
Re: Mkbundle: bundle Mono with applications

The Mono-bundled executable runs (presumably) without Cygwin, without Mono, and without .NET Framework. I do not have another system to confirm it, but I assume it works without those without any problems. Note that some components may not be bundleble, possibly Managed DirectX or GTK#.

(Jordan) I do not have any linux, but it would be a logical assumption. Notice that Cygwin is a Windows port, so any linux could have gcc and zlib already installed.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 06-15-2009, 10:20 AM
Jordan's Avatar
Administrator
 
Join Date: Nov 2005
Location: Hendersonville, NC
Posts: 24,556
Jordan is a name known to allJordan is a name known to allJordan is a name known to allJordan is a name known to allJordan is a name known to allJordan is a name known to all
Send a message via ICQ to Jordan Send a message via AIM to Jordan Send a message via MSN to Jordan Send a message via Yahoo to Jordan
Re: Mkbundle: bundle Mono with applications

Will you send me a test bundle via email so that I can try it on Linux?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 06-15-2009, 10:44 AM
ArekBulski's Avatar
Guru
 
Join Date: Mar 2009
Posts: 1,373
ArekBulski is just really niceArekBulski is just really niceArekBulski is just really niceArekBulski is just really niceArekBulski is just really nice
Re: Mkbundle: bundle Mono with applications

Here is some Mono-bundled application, with simple WinForms gui. Inside you can find the source code, a build, and a Mono-bundled build. Everyone feel free to give it a try.
Mono-bundled test application.zip

For some reason I cannot upload the zip into this thread. I get a database error.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 06-15-2009, 10:47 AM
Jordan's Avatar
Administrator
 
Join Date: Nov 2005
Location: Hendersonville, NC
Posts: 24,556
Jordan is a name known to allJordan is a name known to allJordan is a name known to allJordan is a name known to allJordan is a name known to allJordan is a name known to all
Send a message via ICQ to Jordan Send a message via AIM to Jordan Send a message via MSN to Jordan Send a message via Yahoo to Jordan
Re: Mkbundle: bundle Mono with applications

Thanks, I'll give it a try. You can't upload it because it is so big.

Quote:
Your organization's Internet use policy restricts access to this web page at this time.


Reason:

The Websense category "Games" is filtered.


URL:

Real Family Guy Fans: Which Family Guy Character Are You? - Family Guy Quiz _campaign=CT3K&utm_source=mediafire
I'll have to download at home.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 06-15-2009, 02:44 PM
Siten0308's Avatar
Programming Professional
 
Join Date: Jun 2008
Location: California, USA
Posts: 283
Siten0308 will become famous soon enough
Talking Re: Mkbundle: bundle Mono with applications

awesome, got to try this out, thanks Arek
+rep
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 06-16-2009, 11:19 AM
marwex89's Avatar
Code Warrior
 
Join Date: Jul 2008
Location: Somewhere that is shorter to write than "In the gloomy shadows of my personal namespace"
Posts: 9,849
marwex89 is a glorious beacon of lightmarwex89 is a glorious beacon of lightmarwex89 is a glorious beacon of lightmarwex89 is a glorious beacon of lightmarwex89 is a glorious beacon of lightmarwex89 is a glorious beacon of light
Send a message via AIM to marwex89 Send a message via MSN to marwex89
Re: Mkbundle: bundle Mono with applications

Very interesting, man +rep
__________________

Computers make very fast, very accurate mistakes.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 06-19-2009, 06:42 AM
ArekBulski's Avatar
Guru
 
Join Date: Mar 2009
Posts: 1,373
ArekBulski is just really niceArekBulski is just really niceArekBulski is just really niceArekBulski is just really niceArekBulski is just really nice
Re: Mkbundle: bundle Mono with applications

Thank you all for the rep. I very much appreciate it!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Tags
mkbundle, mono, tutorial



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hacking Applications With Memory Editors TcM Security Tutorials 10 01-05-2010 09:32 PM
Tried to use Mono... and failed. ArekBulski C# Programming 3 04-02-2009 07:08 AM
Installing MONO on CentOS phpforfun Linux Installation & Configuration 2 07-22-2008 08:49 AM
Lesser Known Applications for Linux — Screenwriting kernel Linux News 0 08-22-2007 03:37 PM


All times are GMT -5. The time now is 06:51 AM.


vBulletin v3.8.0 ©2010, Jelsoft Enterprises Ltd.


no new posts

LinkBacks Enabled by vBSEO 3.1.0