Skip to main content Skip to footer

A Look at .NET Core 2.0 and .NET 2.0 Standard

Microsoft’s .NET Core 2.0 and the .NET Standard 2.0 specification have been finalized for a few weeks now, and we’re beginning to see new libraries to support them (such as our own Spread.Services and ComponentOne MVC Edition and Web API controls). For many users, it might not yet be clear why these technologies are important and how they’ll impact their work. These changes to the .NET platform represent another step forward on Microsoft’s path to unify .NET and make it available across even more platforms.

What's the difference between Core and Standard?

Initially, it might not seem clear what exactly each of these technologies provide, but we’ll try to illuminate the differences between them.

.NET Core packages the .NET runtime, a specific set of framework libraries, and software development kit tools and compilers. On the other hand, .NET Standard is a specification that lays out a common set of APIs that all .NET implementations will conform to (at least for the new versions going forward). In other words, targeting this spec will make sharing your code much easier because all the newest .NET platforms will support it.

What are the benefits of .NET Core 2.0?

Microsoft created .NET Core a few years ago as a cross-platform, open-source subset of the larger .NET Framework. Since .NET Core has been around for a few years, it might not be immediately apparent what benefits there are in moving to 2.0, but there are quite a few reasons to consider adopting .NET Core 2.0 if you’ve been using an earlier version:

  • There are some major performance improvements in the runtime and framework, so your code might see a performance boost.
  • NET Core 2.0 implements .NET Standard 2.0, making it easier to use shared code with the other flavors of .NET.
  • More platforms are supported (Microsoft mentions six new platforms), including macOS High Sierra and Debian Stretch.
  • Preview builds of Linux and Windows ARM32 are now available.
  • Use of RyuJIT as the x86 JIT in .NET Core 2.0, which can generate faster code and is open-source.

There are a few framework and language-specific additions as well. For ASP.NET Core 2.0, there is also the addition of Razor Pages (razor syntax based pages) that allow you to create a razor view without a controller. Microsoft released Entity Framework Core 2.0 too — which is a lightweight, extensible, cross-platform version of Entity Framework with .NET Core 2.0. Finally, .NET Core adds some limited support for Visual Basic, and allows you to write class libraries and console applications using VB — with more support coming in the future.

The most important gains from targeting .NET Core 2.0 are the potential performance improvements, the benefits of supporting .NET Standard 2.0, and support for more platforms.

What are the benefits of .NET Standard 2.0?

.NET Standard is a much newer concept, but it's a formal specification of .NET APIs that will be available on all .NET implementations. This makes sharing code much easier between the different varieties of .NET (.NET Framework, .NET Core, Mono, etc.), and it allows you to create a library that could just as easily be used in your web app as it could be in your Xamarin iOS app. It also replaces Portable Class Libraries (PCLs) as the mechanism for building .NET libraries that can be used anywhere.

.NET Standard Library

The main appeal of developing with a target of .NET Standard 2.0 is that the number of APIs incorporated into the spec has expanded significantly from 13k in .NET Standard 1.6 to over 32k. This makes it much easier for new developers to use because there’s a much broader variety of APIs available for use, including many .NET Framework APIs that were missing in earlier iterations. For developers who haven’t tried porting code to .NET Standard, it should now be much easier than in the past.

.NET Standard 2.0 has broad platform support and works on the following:

  • .NET Framework 4.6.1
  • .NET Core 2.0
  • Mono 5.4
  • Xamarin.iOS 10.14
  • Xamarin.Mac 3.8
  • Xamarin.Android 7.5
  • An upcoming version of UWP

For users who are already building libraries targeting an earlier version of .NET Standard, there is a tradeoff for moving to 2.0. Higher versions of .NET Standard make more APIs available to you, but lower versions can run on more platforms. Most of the time, you’ll want to stick with the lowest version that works for you. Microsoft has a table that lists all the versions of .NET standard and the supported platforms — which is available here.

What’s next?

Microsoft has also announced XAML Standard as an attempt to unify their XAML vocabulary similarly to .NET Standard.

XAML Standard

XAML Standard will help further unify the design markup between different platforms and result in more shareable code between UWP and Xamarin.Forms while lowering the learning curve that lies between them. This should make designing UIs much easier, and provide more commonality between platforms. Version 1.0 has not yet been released, but Microsoft is defining the standard in the open and they have an active GitHub site where they continue to take suggestions.

Microsoft has taken a considerable step forward with making .NET universal and available on more platforms. As we move toward year-end, we’ll hopefully see a similar pattern take hold with XAML Standard, but Microsoft seems intent to deliver an easier to work with .NET platform with much more shareable code.

Kelley Ricker

comments powered by Disqus