6

.NET is a language independent platform.

But is it platform independent as well ? How ?

EDIT : I have heard, .NET 4.0 is developed considering plateform independency ! Well, hope it may take over Java, if so !

EDIT : The answer depends upon the way how we define 'platform', like .NET for windows platform and Mono for Java.

But, the question is, don't do we have general development platform which is OS independent !

Does OS independency related to platform independency ?

15 Answers15

19

It's really a matter of how you define "platform".

E.g. .NET is platform independent as long as the platform is .NET, the same way that Java is platform independent as long as the platform is Java. That is to say, .NET (and Java) are, in part, platforms in themselves (CLR, JVM). As long as there is an implementation of that platform available for a given physical platform, yes, you can run the compiled code on it independently.

In the end, "platform independence" is, just as "write once, run anywhere", marketing. But in practice, currently, there are JVM implementations available for a lot more concrete platforms than .NET (although initiatives such as the Mono projects aims to change that).

Cumbayah
  • 4,298
  • 1
  • 22
  • 31
  • Well, .NET/Mono runs on most common CPU's currently available, and Wii/ps3/x360. – Dykam Sep 12 '10 at 10:41
  • 1
    .NET and Java platforms are very different in the sense that .NET contains Windows-specific features (e.g. System.Windows.Forms) whereas Java has no platform-specific features. There is no complete / compatible implementation of .NET for anything other than a Microsoft OS for this reason (Mono isn't fully complete / compatible). Java, OTOH, does have complete and compatible implementations for multiple OSes. – mikera Feb 20 '11 at 12:52
10

To answer this question, I believe that one must first make a clear distinction between the CLI and .NET:

  • The CLI (short for Common Language Infrastructure) is a standard, and as such it is designed to be mostly platform-independent. Here, platform refers to the underlying computer architecture, including the operating system.

    While it is possible that the standard requires certain things which are not possible to implement on all architectures (I'm thinking of very limited platforms, such as embedded systems), but these can perhaps be considered edge cases.

  • .NET is Microsoft's principal implementation of the CLI and runs only on Windows systems. Therefore, .NET is not platform-independent.

    Update (August 2015): At the end of 2014, Microsoft announced that it planned to progressively open-source parts of the .NET Framework (specifically those parts that are relevant for server-side applications). The result is .NET Core by the .NET Foundation.

  • .NET Core is intended to be a cross-platform implementation of the CLI.

  • Mono is also an implementation of the CLI, but one designed to work on different platforms such as Linux and Windows. Mono is definitely more platform-independent than .NET.


Second, there is the issue of binary compatibility of a compiler's output. Because the CLI standard defines the file format (a form of PE executable files) and intermediate code language (called CIL) to be used for assemblies, you can mix components written in VB.NET, C#, and some other languages freely once source code has been compiled to CIL.

In that sense, the CLI (and with it all of its conforming implementations, such as .NET) is language-independent.

Interestingly, you can compile something with Microsoft's .NET compilers, and because of the common assembly file format prescribed by the standard, you should be able to use the assembly in a Mono project — and vice versa. In this sense, the .NET compiler toolchain could be considered platform-independent — but not .NET itself. Remember that the .NET Framework also encompasses a standard library which is targeted at Windows (think WPF, for example).

stakx - no longer contributing
  • 77,057
  • 17
  • 151
  • 248
5

Taken from wiki:

  • No. DotNet is not platform independent.
  • Microsoft .NET runs on Windows natively. However an open source implementation, Mono, allows for it to run on open source systems. It, however, doesn't support all .NET classes, so don't expect anything to run completely there.
  • As you all know that in .NET, there are different compilers like for C# - CSC VB - VBC etc. After your code is complied it will convert to MSIL code which is independent. This MSIL code will be go to CLR & this CLR is platform dependent i.e for Unix platform, you should have Unix-type of CLR, for Windows like the same so we can say that .NET code is platform independent.
Arseni Mourzenko
  • 45,791
  • 28
  • 101
  • 185
Sachin Shanbhag
  • 50,935
  • 9
  • 84
  • 103
  • See Cumbayah's answer: .NET is not platform independent, the same way that Java's windows implementation is not platform independent. – RCIX Sep 12 '10 at 09:49
  • @RCIX - My answer too says that .NET is not platform independent, but then as Cumbayah says, it really depends on what you define as platform. Considering OS as platform, .NET is not platform independent. But considering CLR as platform .Net code is platform independent. So can you explain what is not clear in my answer? – Sachin Shanbhag Sep 13 '10 at 08:25
  • The way you worded it is very confusing, saying that .NET is not platform independent then if you consider that other thing then it is. :S – RCIX Sep 14 '10 at 03:53
  • @RCIX - Actually its taken from WIKI link as pointed out. Probably it is combination of answers from different people I believe. – Sachin Shanbhag Sep 14 '10 at 09:36
3

Not sure what do you mean by your question, but if you want to know if a .NET application can run on any OS, that the answer is no.

.NET Framework targets only some operating systems, like Windows. Other projects are available for other platforms, like Mono on Linux.

Arseni Mourzenko
  • 45,791
  • 28
  • 101
  • 185
2

DotNet is not platform independent or may be partially independent While Java is fully platform independent because of its JVM(java virtual machine). the best example to understand java independency u can run a java program in your "car" microwave,washing machine, or either computer if JVM(java virtual machine) is installed. Java byte code is independent free it doesnt matter while we used mac,windows,unix whatever.

2

There is a cross platform implementation called "mono". The original .NET releases from Microsoft are Windows only.

More info about the mono project: http://en.wikipedia.org/wiki/Mono_Project

softcr
  • 610
  • 3
  • 10
1

Mono is a cross platform implementation of .NET, but it is not supported by Microsoft and is missing some functionality.

Sjoerd
  • 68,958
  • 15
  • 118
  • 167
1

There are some .net implementations on linux maybe on other systems would be compiled as well.
It's called Mono.

bua
  • 4,501
  • 1
  • 21
  • 29
  • Mono supports Mac OS X, Linux, Windows and Solaris. See http://www.go-mono.com/mono-downloads/download.html – Michael Shimmins Sep 12 '10 at 08:59
  • -1 because Mono only implements a subset of .NET, and does not try to be compatible with .NET as a whole. It doesn't guarantee you (and probably never will) full portability of .NET applications, since .NET contains Windows- specific features (e.g. parts of System.Windows.Forms) – mikera Feb 20 '11 at 12:47
  • @mikera You sound like people mentioning mono would hurt your feelings...though it's kind of obvious that mono doesn't fully support .NET and I doubt there are people believe it ever will... – bua Feb 25 '11 at 12:36
1

.Net works fine on MacOSX and Linux as long as you stick to .Net 2.0. Some newer features like LINQ, C# 3.0 etc have also been implemented. You need to take into consideration that file paths, file permissions etc are not working 100% similiar in different platforms.

Forgot to mention that I'm talking about Mono.

jgauffin
  • 95,399
  • 41
  • 227
  • 352
1

Okay. Whether .NET Framework is Platform Independent or not largely depends upon what 'Platform' actually means.

If Platform = Operating System, then .NET Framework is not Platform Independent, .NET Core is.

If Platform = Independent System/PC, then yes .NET Framework is Platform Independent, because of CLR/CLI(Just like Java's JVM).

0

.NET is Platform Dependent because once the code is written it is complied into Microsoft Intermediate Language(MSIL) code which is independent of platform but it is half compiled code,then Common Language Runtime(CLR) convert it into device specific code i.e it is platform dependent.(MSIL is send to JIT through CLR. At run-time all memory allocation is being done by JIT.)

MERLIN THOMAS
  • 475
  • 1
  • 5
  • 13
0

As you know .NET used the framework 4.0.Because of this, the written code(source code) converted into byte code. That conversion is done through MSIL(Microsoft intermediate language).MSIL is special type of compiler that compile the source code into execution code. Which is run or support any platform. So Due to Use of MSIL .NET language is cross platform language.

0

During compilation of .NET programming languages, the source code is translated into CIL code rather than platform or processor-specific object code. CIL is a CPU- and platform-independent instruction set that can be executed in any environment supporting the Common Language Infrastructure, such as the .NET runtime on Windows, or the cross-platform Mono runtime. In theory, this eliminates the need to distribute separate binaries for different platforms and CPU types. CIL code is verified for safety during runtime, providing better security and reliability than natively compiled binaries. The execution process looks like this: Source code is converted to Common Intermediate Language, CLI's equivalent to Assembly language for a CPU. CIL is then assembled into bytecode and a .NET assembly is created. Upon execution of a .NET assembly, its bytecode is passed through the runtime's JIT compiler to generate native code. (Ahead-of-time compilation eliminates this step at run time.) The native code is executed by the computer's processor. However Microsoft has made several improvements which run on .NET which are garnered specifically for windows leaving Mono (its linux based counterpart) much further behind.

Elixir
  • 247
  • 1
  • 3
  • 13
0

.NET is platform independent, since it can be run on more than one version/flavor of OS (Ex: MONO runs various .Net framework versions on many popular operating systems. refer http://mono-project.com/Compatibility)

Narendra Kamma
  • 1,383
  • 1
  • 10
  • 19
  • .NET 1.2 on Linux? Mono currently supports a heap of .NET 3.5 and the upcoming release of 2.8 supports 4.0. To say that Mono isn't a serious implementation is just wrong. There are quite a few people working on Mono for commercial development (including MonoTouch - .NET implementation on the iPhone). – Michael Shimmins Sep 12 '10 at 09:00
  • @Michael, Agreed. Here is Mono compatibility chart http://mono-project.com/Compatibility – Narendra Kamma Sep 12 '10 at 09:40
  • -1 because Mono is unlikely to ever 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:43
-1

.Net is known as partially platform independent, not fully platforn independent. However, .Net supports certain other operating system like win98, winnt, winserver 2000 and new version as well as linux. In the same situation clr are not available for win95 that means .net can't be executed on win95. So we can say, .net is a partially platform independent not fully platform independent.

Bryan
  • 9,644
  • 1
  • 44
  • 70