Is it possible (and feasible) to run .NET applications on the Raspberry Pi with Mono?
If so, how well do they run? Is a basic GUI usable, or does poor performance realistically restrict it to command line applications?
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It only takes a minute to sign up.Sign up to join this community
There is a StackOverflow question quite similar to this, Mono on Raspberry Pi. However, through my own research, I haven't been able to find anything specific to .NET, but rather just C#.
You can install the runtime using APT on a Debian distro by executing:
$ sudo apt-get install mono-runtime
You can also (assuming you have some sort of GUI such as LXDE) install a slow Mono IDE with:
$ sudo apt-get install monodevelop
$ sudo pacman -S mono
The Mono IDE can be installed in a similar fashion:
$ sudo pacman -S monodevelop
Contrary to popular belief, VB.NET compiled code runs fine on the Raspberry Pi, under Debian at least. apt-get install mono-vbnc and then run your VB exe as an argument to mono e.g. mono yourexe.exe
I haven't done any performance benchmarks as I am not writing a performance intensive app but seems fine so far.
.NET code which is using .NET Framework libraries can't run on Raspberry Pi as it requires an ARM compatible version of NETMF or CLR to run. As of now, Microsoft has yet to release Windows on ARM (WoA). Refer to Experiment 19 for Microsoft Research CLR works on ARM.
However, running .NET code (without reference or using .NET Framework Libraries) is possible using Mono as Mono has a CLR for ARM devices.
See also Building Windows for the ARM processor architecture for information on Windows on ARM (WoA).
I've got a command line .NET application to work with Mono. The app is basically doing something akin to port forwarding, taking data received via the serial UART and forwarding it over TCP/IP. It uses the SerialPort, TcpListener, TcpClient and Socket .NET classes, with only minor changes needed to the SerialPort handling code. I'm using the Debian soft float OS.
In terms of performance, the first thing that I came across was some significant slowdowns in some debugging/trace code which was formatting an array of bytes into a string for logging purposes. It was 50x slower compared to running on a PC.
So I'd recommend writing some performance unit tests when porting existing code to the RPi.
For unit testing, NUnit works fine on the RPi...
To install NUnit:
sudo apt-get install nunit