The development of .Net Core
.Net Core is the future for .Net and highlights Microsoft's attempt at offering a more lightweight, modular and modern framework. The lightweight aspect is achieved through .Net Cores Command line Interface, also known as .Net Core CLI.
This means that we no longer need to have a full version of .Net and the common language runtime installed on our machines. We can use .Net Core CLI, which also uses a new runtime called .Net Core Common Language Runtime(CLR), to manage and run our code. The cross platform focus of .Net Core highlights the modular nature of the framework. The prospect of running .Net based applications on multiple platforms with similar commands is highly appealing. Finally, the modern feature is achieved through the open sourced nature of the project. Developers can now access the code, which can be found here. This is in stark contrast to previous versions of .Net, and emphasises that .Net Core is taking a distinct path from its predecessors.
First Steps of a Long Journey
However, such necessary and important changes to alter the direction of a 15 year old framework aren’t going to happen overnight, and unsurprisingly they aren’t. The framework is still in beta, with full support currently only offered on Windows. It is far from production ready and will inevitably face many changes along the way. One such change has been with the name. Initially, the Core aspect of the name was used only in the common language runtime (CLR), .Net Core CLR. The plan was for .Net 5 applications to target the runtime. Microsoft felt that the name .Net 5 would cause confusion with .Net 4.6, by suggesting that .Net 5 is the more production ready and mature framework, while in fact .Net 4.6 is.
Confused? I know I was, and it is clearly still a work in progress as the current repository still makes reference to .Net 5. The current situation with regards to names is that there will be .Net Core 1, ASP .NET Core 1, ASP .NET MVC Core 1 and Entity Framework Core 1.0. This is a drastic improvement over, .Net Core CLR, .Net 5 and Entity Framework 7.0. The new updated names are explicit, easy to follow and place emphasis on the positive direction that Microsoft is taking.
How Cross Platform is .Net Core?
One of the aims of this article was to investigate how cross platform .Net Core is in its current beta and partial support state. In order to test how cross-platform the framework is, I created a simple C# hello world app that is ran using .Net Core on Windows and also attempted to run the simple program on Ubuntu using the exact same commands.
The installation process of .Net Core on Windows is naturally slightly different to that of Ubuntu. However, both installation process were simple and didn’t cause any issues. Instructions for both platforms can be found here.
I pushed my simple hello world program that was created on Windows to GitHub so that I could then pull the code into Ubuntu, ensured there was no difference between the code and the dependencies.
After I pulled the code from GitHub, the first command I used was “dotnet restore”. This command installs the dependencies which are defined in the project.json file. Once the dependencies were successfully, you can run the program with the command “dotnet run”.
Success! The simple little hello world program ran on both Windows and Ubuntu issuing the exact same commands and using the same framework and runtime. This is clearly not an extensive test of cross platform compatibility. It does, however, highlight the cross-platform emphasis that is being placed on the framework and we shouldn’t forget that the project is still in its infancy. Cross-platform compatibility is clearly being considered from the get go. The new CLI is incredibly simple to use and is one of my favourite features due to its consistency between different platforms. Previously, there was no official support from Microsoft with regards to running a .Net app on anything but Windows. There is of course Mono, an excellent alternative runtime that can be used to develop .Net based apps on platforms such as Ubuntu and OS X. .Net Core provides a consistency for cross platform development that Mono cannot.
From a personal perspective, using a beta technology that is still under active development has been a new and challenging experience that I would highly recommend. Furthermore, it is something that I would have perhaps not have undertaken prior to my internship. I would have most likely waited until the framework was in a more mature state with complete documentation and tutorials available.
Prior to researching and using .Net Core I was sceptical about using the framework on Ubuntu and how cross platform and easy it would be to use. I expected the commands and installation process to be considerably different from that of Windows. However, this has not been the case. The installation process has been simple and the commands identical. .Net Core and its related components along with visual studio code, Microsoft’s new cross platform IDE, create an exciting, modern and cross platform future for the framework.
By Michael Close, Intern Web Developer