Cross-platform .NET

November 2nd, 2009

I’ve had a lot of feedback on my running mono article. The majority of feedback was something like: .NET isn’t cross platform, Mono is evil, MS is evil. How can someone say to me that .NET isn’t cross platform when I have an average sized product running out of the box on MS .NET and Mono? I used to participate on a lot of discussions about this a couple of years ago. But then I realized that it was more productive to actually do something instead of discussing these kind of issues.

What makes a Java application cross-platform? Will a Java application be cross-platform if use reference resources like: c:\MyApp\MyApp.ini? And if we have a file named MyApp.ini and get it like getResource(”myapp.ini”)? And if we use specific operating system resources?

The same goes for .NET applications. If the developers are careful, it’s easy to have a cross-platform application. Having a desktop application is hard, that’s true. Microsoft made Windows Forms very Windows specific (using stuff like windows handles), and it’s hard for Mono to make a cross-platform Windows Forms implementation. But there are other alternatives, like GTK#. Even so, I realize that this issue is the least cross-platform of .NET.

But on a web/services scenario, Mono is as cross-platform as you can get.

Related Posts

6 Responses to “Cross-platform .NET”

  1. malcontent Says:

    It takes a lot of very hard work and careful coding to make a cross platform .NET app.

    It’s so difficult that almost nobody does it. Go to codeplex and download ten random .NET apps and see how many of them run in linux.

    On the other hand it’s exceedingly difficult to prevent a java application from being cross platform. You really have to go out of your way and have to avoid all the popular libraries and do insanely stupid things.

  2. Anders Says:

    Hey,

    Just want to say thanks for the previous post. Where I work we have been wondering how realistic it is to run some .NET apps on Free platforms like GNU/Linux and FreeBSD. So thanks a lot for the status report.

    Best
    Anders

  3. Guy Murphy Says:

    As both a .NET and Java developer I’m really not sure what specific characteristics make the .NET platform unsuitable for Web applications and services cross-platform.

    I’m sorry it’s not hard at all, and on the Web side of things the details and difficulties are about application implementation, not the platform.

    I fail to see how it is significantly different for a Windows/.NET developer to set up a Web application on Linux compared to a Linux/Java developer setting up the same on Windows… You will have lots of fun setting up a Java Web app that assumes a Linux environment on a Windows box.

    As somebody currently porting a large inhouse CMS and site management application from C#/.NET on Windows to Java/JRuby/Rails it’s amazing how many nooks and cranies of the “cross-platform” open source stack simply aren’t cross platform at all… If these were crippling concerns Ruby/Rails would have died a long time ago.

    Moving an application that makes assumptions about its environment from one place to the other is tricky regardless of the platform or the direction of the move. If you have a large portion of 3rd party dependencies it rapidly becomes harder regardless of where you are coming from.

    Fortunately the application I’m porting makes very few assumptions about its environment, relies as little as possible on libs, and is a control freak about handling everything itself… the it’s almost a straight port of the architecture onto a seemingly very different platform.

    Design a portable application and it will be portable.

    Also keep on the lookout for people talking politics disguised as technical argument.

  4. Casper Bang Says:

    Just want to add that while Java has the cross-platform UI aspect build into it, that is not as rosy as it sounds. For instance, the majority of popular Java applications are based on Eclipse and/or SWT. And frankly it’s a nightmare to get L&F’s set up correct on all platforms, if you pull in a dependency on some 3′rd part component, it’s almost certain you will have L&F issues to struggle with. It has taken Swing many years to achieve the performance and L&F so that it looks correct, yet you only have to use a JFileChooser, use a composite window manager or rely on a screen reader to assert that this is all pure emulation and not the real thing.

  5. Dan Howard Says:

    Mono is cross platform only to the same degree like python is. There are implementations but no real standard way to ensure cross platform like in Java.

    You example is not so useful. In Java you reference files through a resource URL using application relative paths so there’s no need reference C: drive or anything like that.

  6. Onur Gumus Says:

    I tried 10 random applications in codeplex. 9 of them worked on mono.