One of the disadvantages of using Visual Studio.NET and the .NET framework to develop applications has been the lack of cross-platform support. Since the introduction of the .NET framework and common language run time a few years ago, there have been a few projects designed to bring the .NET framework to other platforms, including Linux and Unix.
We looked at one of these projects earlier, with our tutorial on "Using Mono for .NET Linux Development" and in this article, we are going to be looking DotGNU, the other major project designed to bring .NET to other platforms.
The DotGNU project is touted as the "Free software alternative to .NET" and encompasses a number of projects, including DotGNU Portable .NET, which is designed to be used to compile and run C# and C applications on a multitude of platforms, including GNU/Linux, FreeBSD, Mac OS X, and Windows.
One of the main features of the product is it's compatibility with EMCA standards for C# and the Common Language Infrastructure (CLI), as well as Microsoft's own CLI implementation in the .NET framework.
The project chose to go with a "Virtual Machine" implementation, where bytecode is transformed into a simple instruction set which is then passed to a "Converted Virtual Machine", which then are executed through an interpreter. This approach is different to other open source .NET implementations, but provides more flexibility when porting the project to other platforms.
At the core of the project is the runtime engine (ilrun) and compiler (cscc) with an implementation of System.Windows.Forms that make developing for the platform easier, as it doesn't required translation through another toolkit or toolset.
But enough of the behind the scenes! In this tutorial we are going to look at how to get DotGNU Portable .NET up and running on RedHat Linux and how to run some of the sample applications that are available for this project.
Getting Started
To start, you will need to download either the DotGNU source code or binaries for your particular operating system. Since we are implementing DotGNU on Red Hat, I went the easy route and downloaded the appropriate RPM's from http://phillip.compton.name/pnet/, as shown below in Figure 1.

Figure 1: RPM's for DotGNU
In order to get DotGNU Portable .NET up and running, there are three required components that need to be installed, in the following order:
ââ,¬Â¢ treecc
ââ,¬Â¢ pnet
ââ,¬Â¢ pnetlib
In addition, there are two optional components you may want to install for C support and support for the Mono libraries
ââ,¬Â¢ pnetC
On the download page we looked at earlier, some of these components have been split up into separate RPM files which you will need to install in order. Pay attention to the dependencies within these RPMS and resolve any conflicts before you proceed with the installation.
Once you have these components installed, you can then download and run the sample applications that are available for the project to test your installation.
Testing the Installation
Once you have downloaded and unpacked the sample application, you can run it from a simple command line by typing "ilrun nim" to run the game which should look something like the screen shot below in Figure 2:
And once you have verified that your sample application is working, you can get down to coding your very first DotGNU application. The documentation for the project is extensive with the DotGNU Wiki which is a good resource you can use to get started.
ââ,¬Â¢ ml-pnet
To test the installation, we are going to download and run the sample application that is available from the DotGNU web site. It is an implementation of the old Nim game, where you play against the computer to remove the pegs in order to have one peg left on the board. (Although don't ask me... I wasn't able to beat it once.)

Figure 2: Sample application
Do you need help with .Net? 



1
kryptos - 20/08/04
The links you gave to the DotGNU website don't work here, perhaps you should use this link: http://www.gnu.org/projects/dotgnu/
» Report offensive content
2
t3rmin4t0r - 20/08/04
Have a look at
http://demo.dotgnu.org/~t3rmin4t0r/PhotoTool-4.png
or http://maciek.mil-sim.net/xbox.jpg ...
or http://wxnet.sourceforge.net/screenshots/samples/mac-03.png
The engine's not the only thing that's portable as HELL :)
» Report offensive content
3
t3rmin4t0r - 20/08/04
dotgnu.org DNS is down ...
Please visit http://gnu.org/projects/dotgnu [mirrored on every GNU mirror]
» Report offensive content
4
Sean - 21/08/04
Mono also supports an interpreter; if you are worried about portability, Mono is just as capable as dotGNU.
» Report offensive content
5
Rich - 21/08/04
RE: "Mono also supports an interpreter; if you are worried about portability, Mono is just as capable as dotGNU."
The Mono interpreter (mint) has only recently been of any use performance-wise, and that's only after adopting the converted virtual machine (CVM) approach used in DotGNU Portable.NET's ilrun (similar to the way Mono's wine-based winforms has now been scrapped in favor of using the portable, fully-managed, pnet-style approach). Mint used to be about 100 times slower than ilrun for most programs, and, although I haven't benchmarked the new mint, I doubt it has matched ilrun yet. The CVM in ilrun has more than a two year head start on the new mint CVM, and it's unlikely the Mono folks have managed to add all of the extensive optimizations to the new mint which have been added to ilrun over the years. As for its portability, the Mono track-record for portable design has been abismal to say the least, but I'll accept, for the sake of argument, that mint is as portable as ilrun.
Mono's JIT (mono), on the other hand, is about twice as fast as ilrun for most programs, but Mono will soon lose that edge over ilrun for the few archs which their JIT supports. The development of libjit by DotGNU Portable.NET's lead developer (Rhys) means both will have a CVM-style interpreter and a JIT. The new JIT backend will probably be added to ilrun within the next few months, after the libjit library stabilizes and matures a bit more. Libjit is not pnet-specific, so it will be of use to all free(dom) software runtimes. Designed with portability in mind, and already gaining the interest of some free(dom) software Java runtime hackers, libjit will likely support more archs than Mono's JIT before very long. It's amazing how pnet manages to keep up despite having, at best, 1/20th the manpower.
Rich
» Report offensive content
6
prabhu sargunam - 07/07/05
This is very nice. Such this information is hopeful for many .Net platform developers
Regards
prabhu
» Report offensive content
7
naresh - 12/10/06
it is very gooooooooooooooooooood
» Report offensive content