Beginning modern application development with .NET Core – Part 0: What is .NET core?

This is the first post in a free series of tutorials on “Beginning modern application development with .NET Core”. To view the series, click here: https://elsyms.com/tag/beginning-modern-application-development-with-net-core/

.NET Core is an exciting open source project from Microsoft that brings the power of the .NET development environment to all platforms without having to make use of a third party tool (like Mono). It is relatively new, with version 1 released in June 2016, and is fully supported by Microsoft as one of their first-class products.

The release of .NET Core brings with it a re-architected platform for creating modern applications that consists of the following components:

  • CoreCLR – the core compiler and base types for .NET programming languages (mostly written in C++).
  • CoreFX – the standard libraries, consisting of the main packages used in most applications.
  • DotNET CLI – a command line interface that brings powerful development tools to your favorite shells such as Bash and Powershell.
  • Roslyn – .NET compilers and code analysis platform that allows IDEs other than Visual Studio to provide a better development experience.

What’s different from the regular .NET Framework on Windows machines?

Well, to start with, .NET core runs on nearly all modern operating systems (including Mac, Linux, BSDs and Windows); so you can easily develop your software on Windows and deploy it to a Linux server (or vice-versa).

Secondly, .NET core applications are package based – so you pull in the libraries you need from a package manager and you don’t have to worry about installing the full .NET framework. Everything you need to run your application is shipped with it, making deployments easier to predict and making it simpler to keep all environments the same.

Finally, every component from the compiler to the standard library is open sourced; meaning if you face an issue you can very quickly raise it with Microsoft and community developers.

I’ve heard a lot about different “target platforms” – what are they?

When you develop a .NET core application or library you have the ability for it to target different platforms. There are three main ones, and each has a slightly different meaning or benefit to it than the others.

  • .NET Framework target – this targets the full .NET framework (i.e. .NET 4.6/7) that is only available on Windows operating systems and will therefore only run on environments where that runtime is present.
  • .NET Core target – this targets those applications that run on the .NET Core runtime.
  • .NET Standard target – (libraries only) this targets any runtime that is .NET standard compliant – if you’re using the most up to date frameworks, then you’ll be able to use projects that target this platform anywhere.

For example, if you created a .NET Core class library, you would only be able to use it in other projects that also target the .NET core platform.

However, if you created a .NET Standard class library, you would be able to use it within all projects that target a platform which complies with the .NET Standard.

I thought .NET core had migrated to using JSON files instead of .csproj files?

In the first few versions of .NET Core, the project setup and structure was indeed described within a project.json file. However, as .NET Core was adopted more widely within the eco-system, Microsoft needed a way for all platforms to work together, sharing one project file layout.

It was therefore decided that instead of modifying the tooling for all of these platforms to work with the new JSON format, the ones currently using it would be rolled back to utilise a modified .csproj XML format: one where the pain points experienced by many had been removed.

What will I miss if I migrate to .NET core?

There are a number of major items that are not available in .NET core.

  • WinForms – there is no WinForms support in .NET Core, so you will not be able to update your existing projects.
  • WPF – there is no WPF support in .NET Core, so you will not be able to update your existing projects.
  • WCF – it is currently not possible to create WCF services within a .NET Core application. You can still consume them using the WCF client libraries (https://github.com/dotnet/wcf), but if you want to build them you will need to target the full .NET Framework.
  • SignalR – neither the client or server libraries for SignalR are available in .NET Core (though they are scheduled for release with .NET Core 2.1).
  • AppDomains – AppDomains were discontinued as part of .NET Core.

How do I get started?

This post is the first of many in a series of how to begin modern application development with .NET. Follow along, and you too can build cross-platform applications with the newest framework from Microsoft.

Follow the series by bookmarking this tag. Alternatively, follow me on Twitter, where I will tweet whenever a new post goes live.