In the eleven years since Mono first appeared, the Linux community has regarded it with suspicion. Because Mono is basically a free, open-source implementation of Microsoft’s .NET framework, some developers feared that Microsoft would eventually launch a patent war that could harm many in the open-source community.
Given Microsoft’s public commitment to open source, a patent war likely isn’t going to happen; that would make the company look bad at a time when it needs all the developer support it can get.
Xamarin took the Mono project under its wing in 2011. It has grown since then, paralleling Microsoft’s development of C# and .NET. Mono includes a C# compiler and a Common Language Runtime; as mentioned above, it’s not only C# but a set of EMCA-compliant tools compatible with the .NET framework. Mono runs not only on Linux, but also on Mac OS X and Windows.
But what actually makes it so great? These five things:
C# Is a Great Language
The Mono team is ahead of the curve on C#, incorporating the latest version before pretty much anybody else. There’s support in Mono 3.8 for C# 6.0 features such as primary constructors, auto-property initializers, exception filters, expression bodied members, null propagating operator and the Nameof operator. Microsoft and Xamarin are strategic partners, which benefits Mono, as it means that parts of its library will use the latest Microsoft code.
C# is one of the few languages that can be used not only for desktop and console development, but also mobile and Web development. For Windows, C# programs run under .NET; on all other platforms, it’s on Mono.
There’s a Great Free IDE: MonoDevelop
MonoDevelop, like Mono, is cross-platform and includes code completion for C#, code templates, and code folding. It includes an integrated debugger for Mono and native applications, a visual designer for GTK# applications, and can create ASP.NET and ASP.NET MVC websites. It’s more or less the same IDE used in the commercial Xamarin Studio.
Mono Supports Mobile Development
The commercial versions of Xamarin’s development platform for iOS and Android cost about $300 a year (each). Through these implementations, Mono can support mobile development—it not only comes with a Just-In-Time (JIT) compiler, but also an Ahead-of-Time (AoT) compiler, which outputs native code.
Although this is one of the things that makes Mono great, you can’t use it to develop for iOS on Linux—only Mac.
Mono Is Cross-Platform
A C# executable that was built on Windows will run on Mono on other platforms; it just can’t use Windows-specific features such as Windows Presentation Foundation (WPF). Platforms that will run Mono include Linux, Microsoft Windows, Mac OS X, BSD, Sun Solaris, Nintendo Wii, Sony PlayStation 3, Apple iPhone and Android.
Mono Powers Games Development
Apart from mobile development, Mono is used for various games libraries and game-engine scripting, such as Unity. Although Microsoft’s XNA is no longer supported, MonoGame was created to use the XNA API.
The Cocos2D-XNA game library is a port to C# of the Cocos2D game library, and shows that C# is more than fast enough to run games. This has been forked and slightly rewritten by Xamarin as CocosSharp for iOS and Android game developers. If you don’t want to learn Cocos2D-X and C++ on Linux, Cocos2d-XNA and MonoGame is the way to go.
Another reason that Mono has not been universally welcomed on Linux is that it’s often been difficult to install it. For a long while, you had to build it yourself, and there’s a long list of dependencies. While that’s changing, you’ll find that if you want the very latest version of Mono, you may still have to do the build yourself. There are packages for various Linux distributions on the download page.
If you know C# on Windows and would like to use it on other platforms, Mono is the perfect way; it’s free to use, unless you want to use Xamarin’s commercially-licensed implementations to build iOS and Android apps. Mono also works with Docker on Linux, so it’s a great way to develop complex applications, including websites.