For someone who is looking from the outside, the many flavors of .net can be very confusing. This post tries to summarize the various .net implementations:
- .net framework: The version of .net that most people are familiar with. .net framework is the Windows-only framework that can be used for Windows client apps using frameworks such as WPF and WinForms. This is also the version supported by prior web frameworks such as webforms and older versions of asp.net. This version generally ships with windows and generally updated via windows update.
- .net core: The new hotness that just hit version 1.0 in June 2016. .net core is a cross-platform (Windows, Linux, OSX), MIT licensed open-source implementation of .net from Microsoft. .net core appears to be targeted more towards servers, web frameworks and cloud deployment. .net core is meant to be shipped as part of/alongside your app and is distributed via nuget. This release is also accompanied by “Asp.net core 1.0” which also runs on .net core and thus gains the ability to run cross-platform. Microsoft does not provide a GUI toolkit for client apps for .net core though third-party solutions may emerge. While .net core shares some underlying code such as GC and JIT compiler from .net framework, the API exposed by .net core is not 100% compatible with .net framework.
- Mono: Open-source implementation of .net framework that runs on many different platforms including Linux, OSX, BSD, Android and some game consoles such as Playstation 3. This is under the stewardship of Xamarin (earlier and independent company and now a subidiary of Microsoft). Mono was developed independently from Microsoft and has its own GC and JIT etc. So right now there are two different open-source .net implementations for Linux and OSX: Mono and .net core!
- .net native for Windows 10/UWP: The .net portion of UWP is based upon .net core. However, instead of running apps on top of the .net core CLR, all UWP apps submitted to the Windows store for Windows 10 are compiled ahead-of-time into native code using a proprietary Microsoft tool. This tooling is called “.net native” for UWP. This tooling has some limitations. For example, F# cannot be used with .net native though Microsoft is working on fixing that.
- Mono for iOS: An ahead-of-time compiled implementation of .net for iOS based upon Mono.
- Other misc targets:There are many more versions that are now irrelevant such as Silverlight, .net for Windows Phone 8 and .net micro.
The API surfaces exposed by various implementations are not 100% compatible with each other. This can be a big issue for library writers. Currently, this is “solved” by “portable class library” (PCL) where the developer defines the targets the library is supposed to be portable to and then the compiler will expose the intersection of API surfaces exposed by the targeted platforms. But what if there is a new platform X later on? PCL is tied to the targeted platforms and cannot be run on this hypothetical X even if X exposes all the APIs necessary for the compiled PCL.
Microsoft is trying to address the issue of library (and also programmer knowledge) portability by a new initiative called “.net standard library”. The idea is that there will be a versioned standard library definition. Each platform will advertise which version of the standard library it supports. The standard library will always be backwards compatible (eg: a platform supporting .net standard library 1.3 will also support 1.1). Portable libraries will compile against a particular version of the .net standard library and will then be portable to all current and future platforms that support that version of the library. Microsoft will also focus its own library development plans on this .net standard instead of tying them to a partiular .net implementation.
To summarize, it is amazing to see that .net is now available on almost every platform. Furthermore, many of the implementations of .net are open-soure and developed in the open. On the other hand, the API fragmentation across platforms was also an issue and hopefully .net standard library will make it easy to write cross-platform libraries in the future.