Centric connect.engage.succeed

.NET Core, .NET Standard – why bother?

Geschreven door Redactie Craft - 08 juni 2018

Redactie Craft
Most of us will have heard of .NET Core and .NET Standard by now. If you haven’t, they’re the new developments in the .NET ecosystem. Let’s say you have, then what? Why should you bother about them, especially when the good old .NET Framework is still there?

It seems a very legitimate question to me, wondering whether you should dive into this new buzzword bingo surrounding .NET and migrate all your projects to .NET Core. Most of us are probably working on applications written in .NET Framework and are maintaining code that is already in production (and probably has been for years). These applications run on the full .NET Framework that comes with Windows and are working fine. Should you really want to change all that?

To switch or not to switch? 

Like so often in IT, the answer is: it depends. It depends mostly on the type of application you have and how long you will need to maintain it for. Converting an existing .NET Framework codebase to .NET Core/Standard will take some investment in terms of time, there is no one-click migration. If your app is running fine and you don’t expect to deploy new versions or bugfixes often, it’s probably not worth the trouble, so in that case it’s best for you to just stick to the full framework. For the rest of us: keep reading.

If you are going to do a lot of maintenance on your app, or you’re writing a new app from scratch, you should consider using .NET Core instead of .NET Framework. If you’re writing a library or NuGet package, you should target .NET Standard to maximise the number of potential apps using your library. Target the lowest possible version of Standard to really maximise this reach. If your app is using UWP, WPF or WinForms, you will need to wait a little bit longer, for .NET Core 3.0, to have that supported.

Note that .NET Standard is not an implementation, but just a definition with a specific version number. Check out the .NET Standard Version Table to better understand how these different versions relate to each other.

How to switch?

The first step is to have your libraries target .NET Standard. Targeting .NET Standard instead of .NET Framework gives you some great advantages. First of all, it decouples your code from the framework implementation by using a definition (.NET Standard) instead of an implementation (.NET Framework). You can then decide which implementation you will use: .NET Core or .NET Framework (or Mono, Xamarin, etc.).

This choice might depend on where you want to run your application. .NET Core can run in a lightweight Linux-based container, while .NET Framework always needs the full framework installed (this also means that it’s Windows-only). Use Xamarin for your mobile apps and Mono when you are writing for Unity.

Open source

Now if you choose .NET Core, there are some other great advantages you will get. Because it’s an open source project you can very easily see the source code yourself and contribute towards making .NET Core even better. I guess most of us probably won’t do that, but some of us will and some already have: the .NET Core team has already accepted many pull requests by the community, which has resulted in a more stable and better performing product. Your app will get these improvements, for free!

If you do want to get involved in contributing to .NET Core, you should check out the issues labelled ‘up for grabs’ in the project on GitHub. Those are easy changes you can make to familiarise yourself with the development workflow and the whole idea of contributing to an open source project. You can’t break anything and you’ll even get some mentoring along the way by the actual developers at Microsoft. How cool is that?

Of course, there are more advantages to .NET Core: it is cross-platform, it has built-in dependency injection, apps are self-contained (no more IIS needed!) and not unimportant: it’s faster!

Roadmaps

I believe .NET Core and .NET Standard are the future of .NET, because looking at the roadmaps of various Microsoft developer products (including the MCSD certification), you will see they are dominated by .NET Core. This means it really has the focus of the developers at Microsoft and many cool things will still come in the future for .NET Core (for example: support for desktop applications).

I have also noticed improvements in Visual Studio that you get when developing in .NET Core/Standard. For example: the new and extremely simplified project structure. No more bloated csproj files and no more AssemblyInfo files, it’s all a lot more straightforward. You won’t get that if you stick to .NET Framework. 

Why bother?

With .NET Core and .NET Standard, Microsoft is decoupling .NET from the Windows world and shows that they are focusing on providing a much better developer experience, across all stacks and even beyond the Microsoft landscape. I think we should all embrace this path and take the advantage that we as .NET Framework developers have over the newcomers in .NET land. That’s why I think we should, in fact, bother about .NET Core and .NET Standard.

Want to know more about Craft, the development programme for IT professionals? Check out the website

Tags:.NET

     
Reacties
  • N/A
    Paul
    06 september 2018
    Perhaps by 2020 .Net Core will have the functionality we had back when George Bush was President of the United States.

    I agree that MS has doubled down with .Net Core. It's a pity.
Schrijf een reactie
  • Captcha image
  • Verzenden