.NET Core - What Is It and Why Use It?

Date: August 5, 2019


.NET Core is an advancement over the .NET Framework for cross-platform development. Is it as valuable as it sounds? Let's find out.

 

History of .NET Framework

.NET Core's foundation lies on the same strengths and principles as the .NET Framework, so it makes sense if we start with this predecessor. 

Approximately two decades ago, Microsoft decided to create a runtime and class libraries for developing applications for the Windows platform. Back then, their overall strategy was slightly different than what they pursue today. In the early 2000s, the priority was to push Windows (and other Windows-based products such as Office) over other platforms, and it made sense that the .NET Framework worked exclusively on Windows platform. Besides, there were technical challenges for porting the runtime to other platforms, especially with its growing libraries that quickly tied into the Windows-native instructions. In simple words, you could not readily translate every function that exists on windows into other platform's language.

Since Windows was the most popular desktop platform, and it was the battle between the platforms, the .NET Framework played quite well. For example, I got into .NET in 2003 and stayed with it for the whole time up until now and still counting.

 

Technicalities Behind .NET Framework

In simple terms, the way .NET works is that you have programming languages, their respective compilers, and a runtime. You can pick from the programming languages that can be compiled into the .NET binaries by their compilers. So far, the most popular programming language targeting .NET is C# (my favorite too). You write the programming code in the language of your choice by leveraging some of the pre-existing libraries (predefined functions). Once you turn the code into the binaries, then you need to deploy it to the target machine and run it - that's where the runtime comes into the picture. The runtime takes the binaries and translates them into the machine-understandable instructions, which results in executing those commands by the computer. A lot of times, when people say that they need to install the .NET Framework on their machine as a prerequisite to specific software, they need the runtime (not the libraries).

When I said that the .NET applications ran on Windows exclusively, it was the .NET runtime had this limitation. The language itself can be considered as platform agnostic, as long as it does not use the instructions that are understood only by Windows and not other platforms. This distinction brings us to the next section of this topic.

 

Enter .NET Core

The idea of creating the cross-platform .NET runtime was no novice, as that's how Java worked for all this time (it exists longer than .NET, and it is cross-platform). As I explained before, sticking to a single platform was originally a strategic decision, and later it became a large and difficult undertaking.

About a decade ago, Microsoft saw another opportunity that could help shape its future much better than defending their flagship platform alone - the cloud. At that time, developers started asking for the possibilities to deploy and run the applications irrespective of the final platform. Besides, Microsoft also has the cloud platform (Azure), where they wanted to run several operating systems (that's the point of cloud). Since the .NET Framework would not run there, it would look like defeating Microsoft by Microsoft. This demand influenced Microsoft's decision to pay more attention to cross-platform development, and the advancement of the .NET Framework for the cross-platform was born - .NET Core.

 

Technicalities Behind .NET Core

The technical principle behind developing, deploying, and running .NET Core applications is similar to that of the .NET Framework. The difference is that the .NET Core runtime is cross-platform. The libraries that you reference from your .NET Core code are also cross-platform - they include functions that translate for every platform where .NET Core runs. Therefore, we can say that .NET Core applications are cross-platform.

There are some technical limitations to .NET Core development since it's younger than its competitors, such as Java. Other restrictions are tactical or political (yes, politics are always here). Namely, with .NET Core, you can only develop a small number of application kinds such as Console (command line) and Web. So far, there is no way to use .NET Core for developing native UI applications that would be cross-platform. As a side note, you can build UI applications that will run on Windows only. Despite these limitations, .NET Core is considered being a mature and robust development platform. You will rarely need something more than what it provides, again due to the shifted focus on cloud (not only by Microsoft but by the entire world).

 

What About Containers?

Several companies, including Docker, tried to tackle cross-platform deployment problems. Docker introduced a way of packaging the application and running it using their runtime. Similar to the .NET runtime being cross-platform, the Docker runtime can also run anywhere, although the technical intricacies are more complex and not necessarily in the scope of this topic.

It's important to understand that if you don't target .NET Core, you can still run your application on every platform if you use Docker. However, targeting Docker has consequences on several aspects of the architecture, development, deployment, testing, and hosting choices, so not everybody goes this route. If you decide to use Docker, I still recommend that you target .NET Core as well. The container package for .NET Core application is lighter and better-performing compared to the regular .NET framework code.

 

Summary

In this article, we learned that:

 

There Is Much More To .NET

If you target .NET for professionally developing your applications, you probably need to know much more in-depth intricacies around this platform. The topic of .NET Framework and .NET Core is quite long, and I can not cover it in any single blog post. That's why I also offer group-based training in .NET and .NET Core, which includes advanced aspects from both the programming language (C#), libraries, and the runtime. If you want to learn more about the training course that I provide, you can find it here: .NET And .NET Core fundamentals with C# training.

About Author and Content

The author of the above content is Tengiz Tutisani.

If you agree with the provided thoughts and want to learn more, here are a couple of suggestions:

Ready to take the next step?

Let's Talk