Is .NET platform independent?
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).
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).
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.