I really enjoy working with C# however one of its biggest drawbacks is that it is kind of split-brained between MSFT .NET and Mono. In practice its not a big deal most of the time but it is one of those things that makes the language 'stink' a little. It would get a lot more uptake, I suspect, if one could answer "If I compile it, will it work on every [desktop] platform?" with "Yes.". Right now its "Yes. But you have to compile it under Mono first. And some areas of code may need to be rewritten a little.".

My question is "Does the recent open sourcing of MSFT's C# compiler mean it can be made cross-platform?". That is to say, could C# .NET be made to work cross platform without Mono with the newly release open source components? Or is there more to this I am not seeing?

Further exposition on what the future may hold for C# in light of the open sourced components is not required to answer this question however it is encouraged.

closed as primarily opinion-based by Robert Harvey, user40980, gnat, Bart van Ingen Schenau, GlenH7 Apr 11 '14 at 2:24

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.


It would get a lot more uptake, I suspect, if one could answer "If I compile it, will it work on every [desktop] platform?" with "Yes.".

You can say that today! (or at least you could 8 years ago when I tried)

Seriously. Build some plain jane vanilla C# (really, any .NET language) dll on windows. Good. Now move that over to some linux machine with mono. Guess what? It just works. No recompile, no cross compilation.

The entire point of using a common interface language (bytecode) for the runtime is so that you can do this very thing! Mono didn't somehow make their own bytecode for the language, they're just another implementation of the runtime.

  • 1
    Right. I forgot that CIL is CIL. FWIW there are a number of things that are not implemented in the Mono platform. WPF is not implemented, and probably never will be. – Robert Harvey Apr 10 '14 at 0:16
  • 2
    In any case, the kind of compatibility I have tested is pasting the code into projects in Mono and VS. As long as you're careful, and don't use anything from Windows that's not also implemented in Mono, they will compile in both locations without incident. – Robert Harvey Apr 10 '14 at 0:22
  • 2
    @RobertHarvey - that's true, there's always some subset of the standard library that mono doesn't support, but open sourcing the compiler doesn't change that. – Telastyn Apr 10 '14 at 1:00
  • 1
    The answer is fine, and it shows the false premise of the question, but for the "It just works" statement one has to add - as long as it does not use any .NET library function which is not available in Mono. And any serious real-world code is using a lot of .NET framework libraries. So the And some areas of code may need to be rewritten a little part of the question still holds. – Doc Brown Apr 10 '14 at 6:05
  • @DocBrown: The question specifically asks about the C# language, not the .NET BCL. Mono's C# compiler is very close to Microsoft's, they are usually only a couple of weeks behind. Any C# code will just work on both platforms. – Jörg W Mittag Apr 10 '14 at 9:12

Not the answer you're looking for? Browse other questions tagged or ask your own question.