Is Developing in Mono Cross-Platform

Is developing in Mono cross-platform?

Developing in Mono is definitely cross-platform with a caveat emptor:

  • Strive to steer clear of Windows specific APIs
  • No interoperability with the native Windows APIs... or... you can #ifdef out the Windows API and provide your own Mono wrapper in order to minimize code changes, for example, there's a DLL wrapper that uses Interop to invoke a Win32 method such as 'GetFont', this is a hypothetical example, GetFont will return the Font information, under Mono, that does not exist but however you can create a fake wrapper that returns nothing and incorporate the #ifdef macro to use the wrapper when compiling under Mono, and switch off the macro when compiling under Windows, how you implement the wrapper is up to you.
  • Do not use advanced GUI properties that may not be present in Mono.
  • Use the Environment property such as NewLine to make it independant of Unix's CR and Win32's CRLF, same apply for Path Separator, for Unix '/' and for Win32 '\'.
  • Serialization is slightly different under Mono, you serialize an object on Mono, do not kid yourself into thinking it will be de-serialized under Win32 and vice versa.

Lastly but not least, keep checking from Mono to Win32 and back again, keep testing and testing it.

Is Mono really cross-platform?

Yes it is possible.

It generally works quite well, but I don't think there are any large/medium scale applications on Mono. There are several other apps you may want to have a browse through.

As Mono is a subset of the real thing (.NET), to maintain the best compatibility, you may have to develop in a Mono supported platform (e.g. Linux), then once it works there you can pretty much be certain that it will work on .NET. I'm saying this because although highly compatible with .NET, Mono is not as many people think fully compatible with the entire .NET stack and has other limitations too.

I have done development on it and stumbled across several of those. I hope your project does not have as many .NET dependencies as mine.

What is Cross-Platform Development?

Mono is a cross-platform implementation of the Common Language Runtime as well as much of the .NET Framework. It will allow code developed for .NET to be used on other platforms, including Linux.

There is an IDE associated with it (MonoDevelop), but that is a separate project.

How many languages are supported by .NET ?

There are many .NET languages, though C# and VB.NET are the most common.

Is .NET/Mono or Java the better choice for cross-platform development?

Well....Java is actually more portable. Mono isn't implemented everywhere, and it lags behind the Microsoft implementation significantly. The Java SDK seems to stay in better sync across platforms (and it works on more platforms).

I'd also say Java has more tool availability across all those platforms, although there are plenty of tools available for .NET on Windows platforms.

Update for 2014

I still hold this opinion in 2014. However, I'll qualify this by saying I'm just now starting to pay some attention to Mono after a long while of not really caring, so there may be improvements in the Mono runtime (or ecosystem) that I haven't been made aware of. AFAIK, there is still no support for WPF, WCF, WF, of WIF. Mono can run on iOS, but to my knowledge, the Java runtime still runs on far more platforms than Mono. Also, Mono is starting to see some much improved tooling (Xamarin), and Microsoft seems to have a much more cross-platform kind of attitude and willingness to work with partners to make them complimentary, rather than competitive (for example, Mono will be a pretty important part of the upcoming OWIN/Helios ASP.NET landscape). I suspect that in the coming years the differences in portability will lessen rapidly, especially after .NET being open-sourced.

Update for 2018

My view on this is starting to go the other way. I think .NET, broadly, particularly with .NET Core, has started to achieve "portability parity" with Java. There are efforts underway to bring WPF to .NET Core for some platforms, and .NET Core itself runs on a great many platforms now. Mono (owned by Xamarin, which is now owned by Microsoft) is a more mature and polished product than ever, and writing applications that work on multiple platforms is no longer the domain of deep gnosis of .NET hackery, but is a relatively straightforward endeavor. There are, of course, libraries and services and applications that are Windows-only or can only target specific platforms - but the same can be said of Java (broadly).

If I were in the OP's shoes at this point, I can think of no reason inherent in the languages or tech stacks themselves that would prevent me from choosing .NET for any application going forward from this point.



Related Topics



Leave a reply



Submit