43

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?

2

4 Answers 4

27

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

For Arch Linux ARM you need to install the runtime via Pacman, like so:

$ sudo pacman -S mono

The Mono IDE can be installed in a similar fashion:

$ sudo pacman -S monodevelop
10
  • 1
    What do you mean by "rather to just C#"? Commented Jul 16, 2012 at 8:09
  • @JonEgerton C# is a language while .NET is a framework. You can develop for the .NET framework with C#, but C# can stand alone as an independent programming language. A more relatable example might be: you develop for Android with Java, but you can write a desktop program with Java. C# does not depend on .NET, but .NET depends on C#. Commented Jul 16, 2012 at 18:12
  • Hi sorry, that's not what I meant (I'm a .Net dev!!). It was more the exclusivity of C# and not the other .net family languages (vb.net, J# F# etc). I've never looked into Mono, and hadn't realised it is C# only. Commented Jul 16, 2012 at 21:31
  • 5
    @Andrew It’s the other way round: .NET doesn’t depend on C# – but C# does depend on a runtime such as .NET (or Mono), it’s never in practice an independent programming language. Furthermore, mono is totally language agnostic (as is .NET), so once again it doesn’t depend on C#. Commented Aug 5, 2012 at 16:31
  • 1
    Dont install MonoDeveloper on the device. Thats waaaay to slow. Just mount a networkdrive with CIFS and compile on a fast PC/MAC and then test-run over LAN. Commented Feb 24, 2013 at 1:56
8

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.

1
  • any .NET language compiles into the same IL/Bytecode, so once you trigger the compiler (mono-vbnc or whatever language), your VB is gone and the IL is the thing used in the RUNTIME core. Commented Feb 24, 2013 at 1:58
6

.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).

1
  • 3
    I think your statement is wrong here. It is possible to copy an .EXE file which was compiled on the PC which references and uses .NET framework classes (e.g. the Socket class or TcpListener class for example), copy it over unchanged to the RPi, and have it run perfectly on the RPi under Mono. This is because Mono replaces most of the .NET framework base classes with its own version, using exactly the same namespaces, types and interfaces. Commented Sep 11, 2012 at 5:31
4

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

To run:

nunit-console appUnderTest.exe
1
  • 1
    Speed is a relative thing. But a Raspberry PI running at 1000 mhz (model 2) performs approx like a Pentium 300 mhz, so that might explain why .NET/MONO feels rather slow for a start. Commented Feb 24, 2013 at 2:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.