Warning: This tutorial is obsolete since mono has released seperate mono-basic packages!
Running VB.NET 2005 Applications with Mono
Did you ever had the problem that you got an Visual Basic(.net) app and thought “hey I’ve got mono so I can run it on my linux box” and then you typed in mono vbapp.exe and it just complained about missing assemblies or, in some old versions of mono, other strange messages appeared.
A few months ago (SVN says in August 2006) mono got a new VB runtime and a self-hosting compiler completly written in VB itself. But it isn’t perfect, applications developed with Visual Studio 2005 still won’t start without some tricks and it must be bootstrapped with vbc (the vb-compiler of .NET) first. I also didn’t get mangaged that the compiler builds my VB.net 2005 Applications under mono but that’s not so tragically.
First of all I made a new project in VS05 just for test purposes. But don’t make it too complex, especially the System.Windows.Forms of mono is not very feature-complete yet.
Now ensure that the Visual Studio 2005 extensions (e.g. the XP style) are disabled. Go straight to the project properties and uncheck “Enable application framework”.
So that was the hard part ;). Now you have to build the runtime for mono. At the moment it is not available as a package so you have to check out of SVN manually. Open a shell (you must have subversion installed) and type:
svn co svn://svn.myrealbox.com/source/trunk/mono-basic cd mono-basic\vbruntime VB.build 2 release
If you want to bootstrap the VB compiler too (not really necessary) you can check out with
svn co svn://svn.myrealbox.com/source/trunk/vbnc
open vbnc.sln in VS05 and build it, then you can run bootstrap.bat to self-compile the compiler.
Now you must copy the Microsoft.VisualBasic.dll from mono-basic\vbruntime\bin to your linux box. You can either place it in the folder where your vb project executable resides or put it in the assembly cache with gacutil -i Microsoft.VisualBasic.dll.
And the last step is to run your executable with mono foo.exe and hope it works. If it does you’ll see some ugly windows like this:
At the left side Windows XP, at the right side Linux (yes I like my semi-transparent borders ;o)
Note that not often the result is not so comparable on the mono-side. Mostly something just wont work :(. I hope mono will become better soon.
