8

Can the .NET framework be installed on Linux, Unix, MAC etc. operating systems?

Nick Haslam
  • 1,522
  • 1
  • 24
  • 47
Ravi
  • 663
  • 1
  • 5
  • 13
  • @Ravi, you might want to look at a very similar question here on SO, **[Is .NET platform independent?](http://stackoverflow.com/questions/3656721/is-net-platform-independent)** – stakx - no longer contributing Feb 20 '11 at 10:28
  • @xanatos: I don't know; I didn't change the tag. – Marcelo Cantos Feb 20 '11 at 14:05
  • @xanatos: Seriously. I didn't change the tags. I have no idea why those tag changes ended up against my edit. Ah, yes I do. I did an earlier edit and found that someone else seemed to have reverted my changes, so I grabbed my earlier edit and reapplied it, not realising that I was also reverting their tag changes. You should think twice before accusing people of lying; there is often a perfectly innocent explanation. – Marcelo Cantos Feb 20 '11 at 14:18
  • All lies are conscious, but not every falsehood is a lie. I was not offended, just offering you some advice. – Marcelo Cantos Feb 20 '11 at 14:41
  • @marcelo I intended the 3rd definition of Dictionary.com of lie: an inaccurate or false statement. You intended the first one: a false statement made with deliberate intent to deceive; an intentional untruth; a falsehood. But English isn't my first language, so many nuances can get lost in the translation (or perhaps in my language the translation of "lie" is less strong than in your language, or perhaps in my country lying is something "normal", while in yours it's the greatest of sin) In the end the tags are correct, there are many "good" responses, and the world will continue to spin :-) – xanatos Feb 20 '11 at 15:24
  • 1
    @xanatos: In English, a "lie" is always taken to be intentional, regardless of what Dictionary.com says. There are some usages that modulate this, such as, "Appearances often lie" (from [TheFreeDictionary](http://www.thefreedictionary.com/Lie)), but that is an anthropomorphism used to simplify and add color to an otherwise bland statement ("Appearances often give the wrong impression"). Under no circumstances would a statement such as, "John lied about being out of the country when his wife was murdered," be taken as a simple falsehood; the intent to deceive is always assumed. – Marcelo Cantos Feb 20 '11 at 21:32

6 Answers6

7

You should have a look at the Mono Project.

Mono is

An open source, cross-platform, implementation of C# and the CLR that is binary compatible with Microsoft.NET

Nick Haslam
  • 1,522
  • 1
  • 24
  • 47
  • Mono is nice, but even they don't claim to be fully compatible with .NET, e.g. from their own FAQ " it is very unlikely that the implementation will ever implement everything needed for full compatibility with Windows.Forms" – mikera Feb 20 '11 at 12:36
5

.Net per-se, as most Microsoft sofware, is 100% plataform-dependent. It only works in Microsoft-provided enviroment (like Windows and its different flavors). Theres no official .Net for anything else (Mac, Linux, etc)

BUT...

Some plataforms do try to develop alternatives, emulators, etc, to try to run MS Software. Mono, as Nick posted, is a Linux project to support .Net code to run under Linux.

But Mono is NOT .Net. Its a different sofware, written by different people, that tries to be 100% compatible with .Net (and its actually damn awesome). But its not provided or supported by Microsoft.

And Mono, being an open-source, free sofware, is plataform-independent, as it can be ported to any plataform (currently, it already support several, not only Linux)

So, technically speaking, the correct answer would be:

.Net framework, as provided by Microsoft, is not plataform-indepedent at all. You can not install it in either Linux or Mac

But Mono, an independent, compatible .Net implementation, is supported and avaliable for install in both Linux and Mac, among several other plataforms. And you use it to run code written in .Net

MestreLion
  • 10,095
  • 2
  • 52
  • 49
  • 2
    "Microsoft" would be clearer than "Windows"; xbox isn't windows; zune is windows; WP7 isn't windows; MF doesn't target windows; CE (CF) is tickier to define... – Marc Gravell Feb 20 '11 at 10:22
  • xbox is windows. Its actually a modified PC. But i got your point. Anyway, using "Microsoft" wouldnt be right either: MS is a vendor, not a plataform. So the best term would be "Microsoft-provided plataforms". Ill try to clarify that, thanks for pointing it out – MestreLion Feb 20 '11 at 10:35
  • If xbox is Windows and Windows is OS/2 and all Unixes are BSD etc... I think we can safely refer to xbox as xbox. Of course they reuse some code, but there is very little in xbox that resembles Windows. (Notice how BSD socket security holes seems to affect almost all operating systems.) – Tedd Hansen Feb 20 '11 at 10:49
  • Humm, true. Upon further research, i must agree with you guys: given that code must be recompiled for xbox, its not byte-compatible, (doesnt even share the same APIs), i cant really say that "xbox is windows". Its just a "customized PC" rather than a completely new hardware plataform as, say, PS3. But thats waaaay off-topic :P – MestreLion Feb 20 '11 at 10:59
  • (@MestreLion) I don't think there is a strong implication between Open Source and Platform Independance. A software could be so connected to a platform that porting to another would be as much difficult as rewriting it. It's probably true that, being open source AND being designed from the beginning as platform independant, it can be ported to other systems. – xanatos Feb 20 '11 at 16:41
  • @xanatos: Theres no direct implication, but since with Open Source **anyone** is free to port it, and build binariers for any particular system, odds are MUCH higher that it is avaliable in multiple plataforms. You dont have to wait for a single company decide to port it based on its onw criteria and agenda. I admit this is a very subjective argument, but the fact that most FOSS are indeed avaliable im much more plataforms than closed-source ones gives credit to this implicit relation. – MestreLion Feb 20 '11 at 18:17
2

Linux has the Mono which is a .Net runtime for Linux. I do not know about other OS's.
Anyway, what makes it platform independent is the fact that it is being compiled to MSIL so any platform can implement the run-time and support it.

There is also an implementation for small embedded devices called .Net Micro Framework.

Itay Karo
  • 16,882
  • 3
  • 36
  • 56
  • 1
    Mono is a open source .Net runtime not focusing on any OS. It works on many OS's and systems. – Dykam Feb 20 '11 at 10:12
  • 1
    Mono is great - just be aware that it isn't ever likely to be fully compatible with Microsoft .NET. You can choose to target either Mono (in which case you will be cross-platform) or Microsoft.NET (in which case you are tied to Microsoft platforms). The reason for this is that there are platofrm-specific parts of Microsoft.NET that Mono is unlikely ever to implement. – mikera Feb 20 '11 at 12:40
1

The response to your very precise question is NO. The response to the question "can a .net program be run on these OS" is different. And it's MAYBE. As written by others, look for Mono.

Addendum (this is a later edit)

I now think my answer wasn't complete. I should have answered "Yes. You install wine and then install the .net framework". Here a link with an example (for ubuntu and .net 2.0): http://ubuntuforums.org/showthread.php?t=943298

Yes, I DO know this isn't the answer to what the OP probably WANTED to know, but it's at least a partial answer to what he ASKED.

xanatos
  • 102,557
  • 10
  • 176
  • 249
  • While I was a little meta-ironic, my response was complete and true. So whoever gave me a -1 should at least justify it a little. I even gave a response to an ungiven question. Who am I to read the mind of the questioner? Persons should learn that if they want a good answer they must learn to give good questions. A good question has nearly as much value as a good answer. – xanatos Feb 20 '11 at 12:02
1

.Net can be looked at as two separate parts. One is the ECMA standardized CLI and the other is CLR. CLR is Microsofts implementation of CLI.

CLI can be executed on many devices, such as Windows (x86, x64, ia64 and now ARM), XBox, Zune, mobile phones and even embedded devices (small chips). Mono/Moonlight are implementations of CLI and even parts of CLR partially funded by Microsoft through Novell. Microsoft supports this work and releases source code to aid. Through Mono you can reach most operating systems and CPU types.

There are also compilers that can compile .Net code directly to platform independent code that can be directly executed by the CPU. Nice in case you want to write your own operating system in C#. (I don't remember names, but I can Google some links if interested.)

CLI is designed to be platform and langugage independent. It runs well on most operating systems and CPU's through various implementations. In practice does this mean that it supports for example language features such as case sensitive/case insensitive variables (+ muuuch more) and it has an instruction set compatible with most CPU's (the CLI machine code resembles the instructions most CPU's offer).

Implementations of .Net (overview to answer your question):

Community
  • 1
  • 1
Tedd Hansen
  • 11,020
  • 14
  • 57
  • 93
  • 2
    -1 for not answering the question / a very misleading answer. The standardised CLI is a tiny subset of .NET despite what Microsoft PR would like you to believe, and the rest of it is most certainly not platform independent (e.g. the Base Class Libraries contain Windows Forms - try implementing that anywhere else!). There is no complete and compatible implementation for anything other than a Microsoft platform (mono is a nice project for sure, but it's neither complete nor compatible) – mikera Feb 20 '11 at 12:34
  • Perhaps I didn't explain it clearly. ".Net Framework" is CLR, not CLI. ".Net" is a general term used for CLI and CLR. ".NET Framework" is the platform (in)dependent Microsoft implementation of CLI topped with CLR. My intent was to give a full explanation of all the options and their relation, not just ".Net Framework". Thats how I read the question. :) – Tedd Hansen Feb 20 '11 at 19:17
0

You need to use the free and open sourced alternative .NET implementation called Mono

On wikipedia

Main site

Patrick from NDepend team
  • 12,441
  • 4
  • 53
  • 72