Terug naar overzicht

First .NET Core – .NET Standard experience

Door Werner Kellens

.NET Core

Sep 2019

The question I had was “What is exact the difference between .NET Core and .NET Standard (and when to use it)?” and “Why should we migrate?”. So, the best way to find that out, is to convert an existing project while reading all the documentation.

Difference .NET Standard and .NET Core

You can compare .NET Standard to an Interface and .NET Core to a Class. The main purpose of .NET Standard is to share your code between different runtimes like .NET Core, Xamarin, … It’s important that those runtimes implement this specification.

It’s also good to know that the higher version of .NET Standard contains more APIs but is less supported by platforms. So, my advice is to use the lowest version as possible to have more support. We can say that a .NET Core Class Library is built upon the .NET Standard. With .NET Core you can make an executable project, not with .NET Standard. For more info: .NET Standard versions.

Experience

In a real-world example, I used .NET Standard for a Domain Class Library. I noticed that I still can reference to existing .NET Framework class libraries. I used .NET Standard here to be future proof. When we may be going to write a Xamarin application, I can use and share this library. It will also be platform independent.

The corresponding (NUnit) test project is created using .NET Core because we need to execute the tests.

For the Base Library class which I’m going to use for the different projects and solutions I used again .NET Standard because I want to be able to use it for every project and platform.

I used an ASP .NET Core project for the REST API. Not much is changed but ApiController for example is now migrated, so you can’t use it anymore as a base class. You can still use it as an attribute (since .NET Core 2.1). I hope I can see the performance improvements in the future.

By using .NET Standard projects, I can reuse them for different views like Xamarin, WPF, …. Maybe at this moment your projects don’t need to support different platforms.

For the communication to the backend I created a .NET Standard library.

Conclusion

As a consultant and an early adopter, I always want to use and learn the latest versions. So, I will always choose for migrating to the latest versions. But the customers don’t always have the time and budget to migrate.

I don’t tell the customers to migrate just to be on the latest version. But to be ready for the future, I would suggest migrating to .NET Core. You don’t need to migrate your whole solution at once. You can for example start by migrating an existing library to the .NET Standard. That’s for me a big advantage. That way you can quickly migrate base libraries. It’s also a good practice to separate business code from your views if you have an old code base. I know the migrations I did in the past would be a lot easier if .NET Core and especially .NET Standard was available.

New projects I would create in .NET Core.

And remember that .NET Standard is, according MSDN: One Library to Rule Them All.

Summary of the advantages

  • Performance

  • Cross Platform

  • .NET Core is open source

  • You can host ASP .NET Core applications on Linux for example (cheaper hosting costs)

  • .NET Framework 4.8 will be last major release of .NET Framework

  • You can run multiple .NET versions side-by-side

  • Upgrade cycles

Summary of the possible disadvantages

  • With .NET Framework you have more tools (APIs) then with .NET Core. But this will certainly change in the future.

  • Not all libraries are .NET Core

  • Windows workflow is not ported

  • WCF is not supported. Migration would take 3 years

    • NET Core Web APIs or gRPC (Google RPC, which provides cross platform and cross programming language contract-based RPCs) are the suggested replacements.

  • Webforms are not supported (Blazor is the suggested replacement)

    • Latest release .NET Framework 4.8

    • Linked to IIS

    • Not gaining anything

What I didn’t cover in this article is that we also must take our automatic deployment into account. If you migrate you project, you must keep that in mind.

Future

.NET Core 3.0

This year (September / November) .NET Core 3.0 will be released. The biggest change is that it will desktop support (winforms / WPF) and C#8

Blazor

.NET 5 and beyond

In the future we will have just one .NET (Windows, IOS, Linux, Android, …). The release is scheduled for November 2020. For more info: /dotnet/introducing-net-5/

So, with this knowledge I suggest everybody prepare for migration to be future proof.

Application Logging – “That warm fuzzy blanket for when production doesn’t behave” Thumb

Door Steven Hillaert

Nov 2023

Application Logging – “That warm fuzzy blanket for when production doesn’t behave”

Whenever I see a codebase that has logs, I feel safe. Because when things start to break, I know I’ll have data to help me fix it.

Enabling (as) the next generation software developers Thumb

Door Ruben Verheyen

Oct 2022

Enabling (as) the next generation software developers

Wij zijn allemaal AllPhi. Ieder van ons maakt deel uit van het grote geheel en kan vanuit z’n eigen positie z’n steentje bijdragen. En wanneer we er bewust ...

AllPhi Culture
.NET MAUI, a bright and shiny new bit of technology Thumb

Door Mathias Peene

Aug 2022

.NET MAUI, a bright and shiny new bit of technology

What’s my next experience with MAUI? I’m probably going to continue playing around with the MonkeyFinder application, just to get to know the framework ...

.NET Core .NET Standard
Cache primary btn default asset Cache primary btn hover asset Cache white btn default asset Cache white btn hover asset