5 Reasons to Use Mono for Linux Development

shutterstock_287603561

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.

Check out the latest C# development jobs.

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.

MonoDevelop not only works with C# and VB.NET, but can also build C/C++ applications on Linux and Mac (though the debugger is Linux only).

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.

However…

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.

Conclusion

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.

Image Credit: Evdokimov Maxim/Shutterstock.com

Comments

4 Responses to “5 Reasons to Use Mono for Linux Development”

June 18, 2015 at 6:31 am, Luke Leighton said:

david: you forgot to mention that CLR is a “common language runtime” – interpreted/JIT-compilable byte code. it’s quite straightforward to write alternative compilers for it, and in fact that’s exactly what’s been done: IronRuby and IronPython were the first two that i heard about, and they’re Software Libre projects. i understand that the author of IronPython ended up being hired by microsoft to make sure that it remained stable.

several years ago i looked at developing a simple game using IronPython and the .NET bindings to the GTK runtime. i was very surprised at how easy it was to work out what to do, despite there not being any proper documentation. the general assumption by most people would be that it would be the responsibility of the .NET-to-GTK bindings developer to provide *full* documentation of the GTK API, but of course it’s exactly the same as the standard GTK API documentation, so of course the bindings developer would not duplicate that! and likewise, it might be mistakenly assumed that the IronPython developer would be responsible for providing full and complete documentation of every single possible .NET component (even though absolutely all of them are in effect 3rd party).

also, it can be a little weird to consider “trusting” that IronPython and IronRuby could potentially (and in reality do) provide full, complete, total and 100% comprehensive and reliable access to every single .NET API ever written, because of the inherent way that CLR is designed… but it does. amazingly, that’s even cross-platform. i have no such problems of trust, because i’ve been brought up with cross-compilers, APIs, RPC mechanisms and much more, but i can fully understand that people outside of the w32/w64 community might not appreciate quite how powerful CLR really is.

the strangeness of the extra “hoop” required (looking at 3rd party API documentation sites and trusting the compiler and CLR) – the fact that you’re using something “unofficial” (IronPython or IronRuby to access dynamically self-describing modules and objects) should not put people off, but it does, and that i think is a great pity.

so in short: for those people who don’t like C#, who don’t like using IDEs but prefer to use their pre-existing development techniques such as Makefiles, vim, GNU/Emacs, find, ctags and so on, there’s always IronPython and IronRuby, and although IronPython is and was good enough for me (so i haven’t needed to look for anything else), i’m sure that anyone who needs them would find other IronXXXX CLR compilers out there for their preferred programming language.

Reply

June 18, 2015 at 8:17 am, Rick Seymour said:

All those points also apply to many other programming languages which have been available for linux for a long time. However, .net has been, from its inception, a windows-centric development platform. The proof are many of it’s APIs which are not portable nor open source. So I prefer not to get involved with mono (which, BTW, remember has always been lagging behind the official implementation) when we have plenty of alternatives.

Reply

August 12, 2015 at 10:47 pm, J. Wezensky said:

As a long-time, professional Visual Studio developer, I was very impressed with what Mono and MonoDevelop have done. Although it lacks a majority of the bells and whistles that VS has, it has what it needs to get the job done.

I actually found it quite refreshing, developing an app in a familiar language (C#) and having it run on Linux and OS X machines.

The only hassle is learning GTK# when you are used to Microsoft WinForms. They are two totally different animals.

Reply

October 11, 2015 at 3:07 pm, Debasis Goswami said:

I am an MSDN subscriber and have done professional development on C# and Microsoft platforms for a long time. Although my professional work require me to be technology agnostic, and play with a variety of technologies, I have liked Microsoft platforms for a long time for one simple reason. In the end of the day, a business usually (of course, not always) gets best bang for the buck (ROI) with a carefully planned development under Microsoft platforms. However, that said, I like to play on Linux on my time and one thing had been consistently disappointing for me in the past is the inability to port the simple elegance of a c# application over to Linux. I decided to look at Mono back again after a long time, and I think there is hope. This thing is progressing better than before. Not enough yet for commercial adoption, but for hobby side. 🙂

Reply

Post a Comment

Your email address will not be published.