06
Sep
2018

Life Cycle for .Net Core 2.0 Moving Towards to 2.1

.NET Core 2.0 was released on August 14, 2017 as a non-LTS (Long Term Support) release to evolve existing .Net Development services strengths to the next level. Non-LTS release is supported for 3 months only after the next subsequent release. The next release of .NET Core 2.1 was on May 30th, 2018. As a result, .NET Core 2.0 is supposed to be supported until September 1, 2018.

The major components of .NET Core are:

  • A small runtime of .Net Core is built from the same codebase as of the .NET Framework CLR.
  • The .NET Core runtime includes the same GC and JIT but it doesn’t include features like Application Domains or Code Access Security. The runtime is delivered via NuGet that is a part of the ASP.NET Core package.

.NET Core also includes the base class libraries that are largely the same code as the .NET Framework class libraries. These libraries are shipped as System.

Since there were few critical diagnostics issue with .NET Core 2.1 that prevents user to update to .NET Core 2.1. Microsoft intends to fix this issue in the .NET Core August 2018 update. Based on this the time frame for the support has been extended for the .NET Core 2.0 to October 1, 2018. This extension is a bit of relief for those affected by this issues and needs support for upgrading to .NET Core 2.1.

After this time, custom .NET development patch updates will no longer include updated packages of container images for .NET Core 2.0. So it’s necessary to plan the upgrade from .NET Core 2.0 to 2.1 now.

.net core

New features in .Net Core 2.1

The enhancements and new features of .NET Core 2.1 includes in the following areas:

  1. Tooling : A major focus of .NET Core 2.1 is improving build-time performance, especially for incremental builds. These performance improvements apply to both command-line builds using .Net build and to builds in Visual Studio.A number of tools that were available only on a per project basis using DotnetCliToolReference are now available as part of the .NET Core SDK.
  2. Roll Forward : All .NET Core applications starting with the .NET Core 2.0 automatically roll forward to the latest minor version installed on a system.Let’s take for .NET Core 2.0, if the version of .NET Core that an application was built with is not present at runtime, the .Net application development automatically runs against the latest installed minor version of .NET Core. In other words, if an application is built with .NET Core 2.0 and .NET Core 2.0 is not present on the host system but .NET Core 2.1 is, the application runs with .NET Core 2.1.
  3. Deployment : dotnet publish now publishes self-contained applications with a serviced runtime version. When we publish a self-contained application with the .NET Core 2.1 SDK (v 2.1.300) the application includes the latest serviced runtime version known by that SDK. When we upgrade to the latest SDK, it will publish with the latest .NET Core runtime version.

    Using the .NET Core 2.0 SDK, the self-contained applications are published with the .NET Core 2.0.0 runtime unless a different version is specified via the RuntimeFrameworkVersion property. We no longer need to set this property to select a higher runtime version, for a self-contained application. The easiest approach now going forward is to always publish with .NET Core 2.1 SDK (v 2.1.300).

  4. Windows Compatibility Pack : When we port existing ASP.Net software development code from the .NET Framework to .NET Core, the Windows Compatibility Pack can be used. It provides access to 20,000 more APIs than that are available in .NET Core. These APIs include types in the System.Drawing namespace, the EventLog class, WMI, Performance Counters, Windows Services and the Windows registry types and members.
  5. JIT compilation improvements : A new JIT compiler technology called tiered compilation (also known as adaptive optimization) is incorporated in .NET Core that can significantly improve performance. Tiered compilation is an opt-in setting.
    • To use tiered compilation in all projects that use the .NET Core 2.1 SDK the following environment variable needs to be set.
      COMPlus_TieredCompilation="1"
    • To use tiered compilation on a per-project basis, add the <TieredCompilation>  property to the <PropertyGroup>  section of the MSBuild project file.
    <PropertyGroup>
    <!-- other property definitions -->
    <TieredCompilation>true</TieredCompilation>
    </PropertyGroup>
  6. API changes : Working with arrays and other types of memory is much more efficient in .NET Core 2.1 as some new types are included. These new types included are:
    • System.Span and System.ReadOnlySpan
    • System.Memory and System.ReadOnlyMemory
    using System;
    class Program
    {
    	static void Main()
    	{
    		int[] numbers = new int[100];
    		for(int i=0;i<100;i++)
    		{
    			numbers[i]=i*2;
    		}
    		var part = new Span(numbers, start: 10, length: 10);
    		foreach(var value in part)
    			Console.Write($"{value} ");
    	}
    }
    // The example displays the following Output:
    // 20 22 24 26 28 30 32 34 36 38

Enhancement in ASP.Net Core 2.1

  • SignalR : This has been rewritten for ASP.NET Core 2.1.
  • Razor class libraries : ASP.NET Core 2.1 makes it easier to build and include Razor-based UI in a library and share it across multiple projects. The new Razor SDK enables building Razor files into a class library project that can be packaged into a NuGet package. Views and pages in libraries are automatically discovered and that can be overridden by the app. The app startup time is significantly faster by integrating Razor compilation into the build.
  • Identity UI library & scaffolding : ASP.NET Core 2.1 provides ASP.NET Core Identity as a Razor Class Library. Apps that include Identity can apply the new Identity scaffolder to selectively add the source code contained in the Identity Razor Class Library (RCL).

Migrate from .NET Core 2.0 to 2.1

The supported upgrade path from .NET Core 2.0 is via .NET Core 2.1 and Instructions for upgrading are as follows:

  1. First change the target framework to .NET Core 2.1 by updating the project file to <TargetFramework>netcoreapp2.1</TargetFramework>.
  2. Then replace the package reference for Microsoft.AspNetCore.All with a package reference for Microsoft.AspNetCore.App.
  3. Further remove <DotNetCliToolReference> references for tools that are bundled in the .NET Core 2.1 SDK (v 2.1.300 or later). These references include:
    • dotnet-watch (Microsoft.DotNet.Watcher.Tools)
    • dotnet-user-secrets (Microsoft.Extensions.SecretManager.Tools)
    • dotnet-sql-cache (Microsoft.Extensions.Caching.SqlConfig.Tools)
    • dotnet-ef (Microsoft.EntityFrameworkCore.Tools.DotNet)

Stay Connected to further know about the new .Net core update version 3.0 with the set of new features and its compatibility with windows/desktop applications (support to Winforms & WCF).



Comments

2 thoughts on “Life Cycle for .Net Core 2.0 Moving Towards to 2.1”

  1. Under the section of enhancement, you have mentioned regarding the changes in SignalR. Please brief me, I am more intended to know what are the minor or major modifications that came up in SignalR.

    1. Hi Vernica, First of all thanks for reading this article. In ASP.Net 2013 the SignalR support was deducted, but now with ASP.Net Core, it is available back and even extensible to two built-in hub protocols namely – JSON based on text protocol and MessagePack based binary protocol. With the new version 2.1, it is fully featured and has significantly improved, but the jQuery dependency is removed.

Leave a Reply

Your email address will not be published. Required fields are marked *