Learning a new development framework is always a challenge. Plus, as a developer, there are a variety of frameworks to choose from and it is difficult to know which is optimal for the job. Even if you are currently developing in .NET, the .NET Core is different enough that you will need to study how to use the tools and techniques properly. To understand .NET Core, it helps to know where you are starting from. Which brings us to-
About .NET Framework
Microsoft began working on the .NET framework in the late 90’s. The software development tool has undergone tremendous transformation since then. What made the original framework so appealing was its inclusion of class library which provides developers the choice to write applications in any language – C#, C++, VB etc. Programs written in .NET are executed in a software ecosystem called the Common Language Runtime (CLR)- which is an application virtual machine that offers memory management, security and exception handling.
Due to its consistent programming model, less complex developments efforts & debugging, direct support for security, .Net is popular with developers and programmers. Furthermore, it simplifies assembly on computers with framework installed and makes application deployment and maintenance straightforward.
Microsoft has made some big modifications to the .NET Framework and specifically introduced .NET Core.
What is .NET Core?
The key concepts present in .NET Framework (that are mentioned above) are also present in .NET Core. One of the biggest drawback of the .NET framework – was failing to share code across platforms – which is possible with .NET Core. It provides a library which can be deployed over diverse platforms and also enables developers to import the parts of the Framework needed for their projects.
.NET Core Runtime assists developers to improve the platform; the code provides developers with a fully-supported, open-source cross-platform .NET stack for creating server and cloud applications. This comprises of compilers, the CLR, and the core .NET base class libraries, plus the higher-level .NET web, API Frameworks and Data.
.NET Core is a framework that includes Universal Windows Platform (UWP) and ASP.NET Core. To make .NET Core a reality, the authors made the .NET Standard Library and the common infrastructure. .NET Core is all three of these things.
What are the key features of .NET Core?
The following are the most distinguished features of .NET Core –
The .NET Core Platform Is Open-Source
.NET Foundation is a community which .NET Core is a part of; it is created to promote innovativeness in the .NET development framework. The .NET Core project, considering its priority of endorsing innovativeness, is starting with its creation by the developers and the .NET team dedicated to the principles of open-source software.
There are many advantages of using this open-source platform. You have more control in utilizing it, changing it and the transparency in its code can offer information – and inspire your own projects based on .NET Core. Furthermore, since .NET Core is more secure- developers can correct errors and security risks more quickly. Given its open-source position, the .NET Core is more stable, in contrast to the proprietary software which is defined and then left by its creators, the code behind the platform’s tools will continue to be publicly accessible.
MS products often have a complex installation process, which includes registry entries, COM components, GAC, special folders- all are designed to benefit from the Windows-only features. The .NET Framework is dependent upon these constructs- making it incompatible with other operating systems.
Thus, while shipping an application that is reliant on .NET Framework, the installers have to have the foresight if the wrong .NET Framework version is installed and offer a way for the user to get the correct one. Most modern Windows versions comprise of .NET Framework, therefore making it easy to install certain applications. Complications, however, can occur if the application uses features that are not installed by default., for e.g. ASP.NET integration with WCF or IIS components.
.NET Core’s defining feature is its flexible deployment — you can install the platform as a separate installation or you can install it as part of your application. Its modular design implies that you only include the dependencies you need.
Those dependencies will go into the same folder as your application. Deploying an application is as easy as copying a folder. Another advantage to this approach is that you can have multiple versions running side-by-side. This approach is crucial to make the deployment experience consistent on all platforms.
A Cross-Platform Design
The .NET Core platform is a cross-platform design and already runs on Mac OS X, Windows, Linux – as its cross-platform attribute was one of the most crucial priorities for its development. .NET Core’s availability on more than just Windows platform, makes it a better option to be used by all developers – which includes Linux and Mac developers – and also offers the entire .NET framework the advantage of feedback and use from a much broader set of programmers.
This additional feedback leads to a product that functions much better for all of its users and makes the .NET Core a step forwards for ‘software-defined’, rather than ‘platform-defined’ applications.
Expanding the reach of your libraries
The .NET Standard Library can be used to write your application/ library with .NET Core; afterwards, it can be shared across many platforms. The same library can work in your backend service ‘on-premise’ or in the cloud, and in your client application running on a tablet, mobile or desktop. Rather than building apps for Android, Windows and iOS, you can build a single app that works on all platforms. .NET Core is small and perfect for use in containers- which scale easily and decrease development time.
.NET Standard library and the .NET Core establish a common standard. Before, when a new version of OS was introduced, it was the developer’s job to redevelop the application or library for that new platform and distribute the update. Rebuilding or redistributing is not required with .NET Core. If the new platform supports all the dependent libraries – it supports the application.
The four key-parts that make the composition of .NET Core
.NET runtime is the primary essential factor which provides .NET Core its standard services, comprise of native interop, garbage collector, type system as well as assembly loading. The second vital factor is the set of framework libraries (CoreFX) offering primitive data types, fundamental utilities and app composition types.
The third most necessary aspect is that the .NET Core developer experience is created by a set of SDK tools and language compilers that are a part of .NET Core. Fourthly, the “dotnet’ app host chooses and hosts the .NET Core Software Development Kit (SDK). This comprises of .NET Core Command Line Tools, the dotnet driver and the .NET Core- all you need to develop a .NET Core application or a .NET Core library.
Features Command-Line Tools
.NET Core’s command-line tools, Microsoft says, mean “all product scenarios can be exercised at the command-line”. High-level tools, like the Integrated Development Environments, are derived from .NET Core Command Line Interface (CLI). They are utilized for creating applications on this platform.
Same as the .NET Core platform, this CLI is cross-platform, therefore after you have learned the toolchain, you can use it the same way on any supported platform. The .NET Core CLI is the foundation of applications to be transportable whether .NET Core is already installed or an application is self-contained.
What is the difference between .NET Core and .NET Framework?
.NET Framework allows building applications for a single platform- Windows. .NET Core, however, is cross-platform and supports three different operating systems, they are OS X, Windows and Linux.
Unlike .NET Framework which requires to be installed as a single package and runtime environment for Windows, the .NET Core, however, is cross-platform and needs to be packaged and installed independently of the underlying OS. The developers have to compile the Nuget packages included in .NET Core. Furthermore, developers can collect the Nuget packages directly into the application or they can choose the other option of placing them in a folder inside the application.
As a formal condition of .NET APIs, the .NET Standard Library fulfills the requirements of diverse runtimes and maintains the uniformity in the .NET ecosystem. Every version of the .NET Framework utilizes a specific version of the .NET Standard Library.
For e.g. .NET Framework 4.6 used .NET Standard Library 1.3, meanwhile, .NET Framework 4.6 2 used 1.5 version of the .NET Standard Library. .NET Core, however implements .NET Standard library 1.6.
.NET Framework was released as a licensed, proprietary software framework. Then, Microsoft made specific components of the .NET Framework open-source. The company also released .NET Core as an open source software framework. Therefore, both individual and enterprise developers can develop apps with .NET Core without spending much on licensing fees.
The application model of .NET Framework includes Windows Forms, ASP.NET, and Windows Presentation Foundation (WPF). On the other hand, the application model of the .NET Core also includes ASP.NET Core and Windows Universal Apps.
.NET Core, unlike .NET Framework, is made with features to simplify the development and deployment of the cloud-based application. The developers can utilize ASP.NET to build a variation of cloud-based applications quickly. Plus, they can publish the applications directly to the cloud by availing the cloud-ready configuration included in the ASP.NET Core.
Modular Collection of Libraries
Even though both allow developers to benefit from the robust class libraries, .NET Core uses a re-designed common language runtime called CoreCLR and features a modular collection of libraries called CoreFX. Hereafter, the developers have the option of picking and using the libraries needed by each application and improve the application’s performance by eliminating unneeded libraries.
Why Choose .NET Core?
.NET Core is at the center of innovation
Due to backwards compatibility, a lot of efforts go into seeing that the changes made in the new versions of .NET Framework won’t break the existing applications. Now, even if this isn’t the case 100% of the time, but it’s pretty close.
The efforts put in to avoid breaking changes, however, stifle the innovation in the Framework. On the other hand, with .NET Core, it is easier for a team to work on their library independent of the core libraries. The .Net framework is shipped as a whole one package, meanwhile, .NET Core is divided into pieces. Developers can now select which version of the library they want to use, as long as it is outside the .NET Standard Library, and the Core teams can innovate with less difficulty.
ASP.NET Core outdoes ASP.NET framework
Much of the ASP.NET was limited by the bequest of System.Web library. The .NET Framework supports the older versions of ASP.NET projects and that constraint has restricted ASP.NET’s evolution. Meanwhile, Microsoft decided to rewrite the whole stack with Core- this means breaking changes – but the benefits are worth the effort of migrating.
Release cycles are faster
If you have ever reported a bug in Framework, you know how long it takes it to be fixed. The Framework has long release cycles, which usually measure at least a year and there are small windows during these cycles for feature work. Every code change can cause issues in unpredicted places elsewhere in the Framework. Giving adequate time to test the framework, there are many times when the code changes are constrained or even heavily monitored. Thus, if you found a bug in .NET, then it would be better if you find a workaround rather than wait for an update.
While .NET Core follows a much speedier release cadence. Developers can use nightly builds to test early. Libraries not included in the .NET Standard Library can take their time for releases. As everything is open source- any developer can propose a fix.
Working with .NET Core doesn’t mean starting from the scratch
.NET has been around for almost two decades. The Framework code has been hardened over time and its developers have gained hugely from the experience.
Much of the Framework code that has been ported to Core is untouched. This gives .NET Core is also completely supported by Microsoft. Support can be a blocker for some companies to adopt open source software. This decreases the risk of utilizing Core for your applications.
.NET apps can be cross-platform
The existing .NET Framework applications can run on other operating systems. This is excellent for developers who want to utilize the same code in other parts of distributed application or library authors wanting to expand their audience.
Where is .NET Core 2.0 headed?
Microsoft writes “The .NET Core 2.1 release, across .NET Core, ASP.NET Core and EF Core is intended to improve the product across the following themes:
- Faster Build Performance
- Close gaps in ASP.NET Core and EF Core
- Improve compatibility with .NET Framework
- GDPR and Security
- Microservices and Azure
- More capable Engineering System”
.NET Core will debut an approach to framework compatibility called the “minor-version roll-forward”- this reduces the need to match an application to its runtime. This means an application targeting Core 2.1 can run without modifications on upcoming minor versions like 2.2, 2.3 and so forth.
Ready to run (R2R) precompiled assemblies are being scheduled for a decrease in their install sizes. The approach taken in .NET Core 2 offers itself to speedier startup times, however, extends minimal advantage once the assembly is running. As most customers commonly launch an application and let it run, a fast startup time is of minimal value compared to a reduction in storage space.
Furthermore, the command-line tooling supporting .NET Core is also up for improvement. A variation of new commands will be included in .NET Core 2.1 to support packaging and installation of developer’s tools – increasing developer convenience.
“The command dotnet pack will package up assemblies for distribution while dotnet install tool exampleApp will install it to a user’s .dotnet\tools folder,” writes InfoQ. This location will be automatically added to the path so it is then likely to make use of the new executable irrespective of the local directory.
Furthermore, enhancements for self-contained apps to correctly be packaged with dotnet publish command has been made. In 2.1, the resulting package will also include the latest patched runtime by default.
You catch up on the improvements made by following .NET Core 2.1 roadmap blog on Microsoft Developer Network.