Mono on RaspberryPi


Today realised that Mono had been ported to the RaspberryPi. In theory, given that Mono runs on Linux and that Rasperian is a Linux distribution, it should always have done so. But theory and reality rarely meet in IT, and the fact that Raspberry Pi is an ARM chip initially meant that it did not work.

Well now there is a Mono Distro for the RasperryPi. To install:

sudo apt-get update
sudo apt-install mono-complete

Initial Test

You could write an Hello World terminal exe to test using a text editor on the Pi. In which case to compile & run (assuming you call your program file hello.cs) is simply a matter of:

msc hello.cs
mono hello.exe
(In fact if you make the .exe executable using chmod, then you can just type hello.exe)

A more significant test, assuming your Pi is networked to a PC or MAC is to use the Visual Studio IDE from Microsoft (Community edition is free) to write a C# Windows App, compile and run on your PC/Mac to make sure it is running and then FTP the Debug directory on to your Pi. (I use WinSCP for FTPing – brilliant free App)

Windows App – VS2017

On the PI

  1. Open a Terminal window
  2. CD to directory containing the .exe
  3. sudo chmod 777 WindowsFormsApp1.exe
  4. sudo ./WindowsFormsApp1.exe


DotNet Windows App – Raspberry Pi

How neat and powerful is that. Develop a Windows based DotNet app on a PC/Mac. Copy the executable over to a RaspberryPi and run. Superb

However do note, Mono is the standard DotNet environment, extensions (such as WPF) are not included. So do not expect every DotNet program developed under Windows to run on the Pi. Obviously any library that uses unmanaged code will not run. But even so this is such a powerful development env for the Raspberry Pi. And Note: If you do not have (or want) Visual Studio on your PC/Mac, or want an immediate IDE, then there is a Mono IDE.