If you're developing on the Microsoft stack or hear updates regarding Microsoft-related technologies for building software, you will likely come across terms such as .NET Framework, .NET Core, .NET Standard, and Xamarin. You might have read the documentation about them but you're still confused about how they differ and when to pick one over the other. In this post, I'll talk about .NET Framework, .NET Core, Xamarin and their differences.
.NET Framework
The .NET Framework was released in 2002 and primarily runs on Windows. It ships as part of the Windows operating system and updates through Windows Update when new versions become available or through optional standalone installers. It includes the class library (.NET Framework Class Library) which provides language interoperability among the supported languages and the Common Language Runtime (CLR), which is the environment where the code is executed.
The Inception of Xamarin
The .NET Framework primarily runs on Windows and if you use Linux, you can't develop .NET applications on Linux or publish your .NET programs to non-Windows operating systems. However, Microsoft later published the Common Language Infrastructure, which is an open specification developed by Microsoft and standardized by ISO and Ecma. With this standard, a version of the .NET Framework was developed to run on Linux and it is called Mono. Mono has evolved to support a wide range of operating systems and applications. Mono is a cross-platform implementation of the .NET Framework and it's used to build desktop and mobile apps for any operating system.
Xamarin is a company that started in 2011 with a focus on building a suite of tools that allowed cross-platform development with C#. They maintained the Mono project, including MonoTouch which allowed developers to build iOS apps with C#, and Mono for Android for building Android apps in C#. The Mono project has evolved since Xamarin took over and they released Xamarin.iOS, Xamarin.Android, Xamarin.Mac, and other tools that enable the development of cross-platform native apps in C#.
Xamarin.iOS and Xamarin.Android are implementations of Mono for iPhone and Android-based smartphones. In February 2016 Microsoft acquired Xamarin Inc. and has gradually integrated the Xamarin platform and tools with Visual Studio and .NET offering. So today, Xamarin is a platform that extends the .NET developer platform with tools and libraries for building apps for Android, iOS, tvOS, watchOS, macOS, and Windows. Xamarin apps use Mono as the .NET implementation for running the apps and you can create these projects from Visual Studio or Visual Studio for Mac. The unique features that Xamarin brings to the .NET ecosystem include:
- Base framework for accessing native features
- Extensible Markup Language, also known as XAML, for building dynamic mobile apps using C#
- Libraries for common patterns such as Model View ViewModel(MVVM)
- Platform-specific libraries
- Editor extensions to provide syntax highlighting, code completion, designers, and other functionality specifically for developing mobile pages
Evolving into .NET Core
.NET Framework is a monolithic framework that runs only on Windows and has to be installed for every machine that needs to run .NET apps on Windows. Its monolithic nature also caused a slow release cycle. In today’s world where serverless and microservices architectures are heavily adopted, we need a lightweight framework with little memory footprint to run our applications, and the .NET framework doesn't play well in this space. However, Microsoft wants to innovate and satisfy this user base. Thus, .NET Core was built from scratch to lay the foundation for the future of the .NET platform and to include a flexible and modular architecture that would allow Microsoft to innovate on their offerings.
.NET Core is a lightweight, modular, and cross-platform implementation of .NET for creating modern web apps, microservices, libraries, and console applications that run on Windows, Linux, and macOS. .NET Core is composed of Nuget packages so that you can install only the modules or packages needed to run your app, and you can bundle them together with your application and your users do not need to install the framework on their machine.
Its modular architecture means a faster release cycle from the .NET team. It being lightweight, modular, fast and cross-platform means you can use it for microservices applications and deploy them in Linux containers. You can also run it on serverless platforms.
While there are different implementations of .NET, the goal is to maintain one consistent API through .NET standard specification. While the Common Language Interface (ECMA 335 specification) establishes a small set of standard libraries for .NET implementation, the .NET Standard specification encompasses a broader range of APIs. Its goal is to:
- Define a uniform set of BCL APIs for all .NET implementations to implement, independent of workload.
- Enable developers to produce portable class libraries that are usable across .NET implementations, using this same set of APIs.
- Reduce conditional compilation of shared source.
Conclusion
In this post, I briefly went through the history of .NET and its varying implementations. The Common Language Interface is an open specification standardized by ISO and Ecma, which defines a set of APIs that any implementation of .NET should adhere to. The classic .NET Framework is an implementation of this specification, as is .NET Core (which is an evolution of .NET Framework but designed to be platform-agnostic and modular) and Xamarin (which includes Mono, Xamarin.iOS, Xamarin.Mac, and Xamarin.Android).
Originally Published on Telerik Blog
Cover Photo by Tadas Sar on Unsplash
Top comments (0)