.NET Core 1.0 is released, but what is .NET Core really? This article steps into the framework, ASP.NET Core, the runtime, the tools, and the .NET Standard.
.NET Core is a new .NET Framework. Over time it might replace the full .NET Framework, but for this to be true there’s a long road ahead. The first version fulfilled the goal to be open source, available on multiple platforms, using new modern patterns…
It’s a version 1.0 framework; .NET Core is at the beginning. However, the first version of .NET Core is a lot bigger than .NET Framework 1.0 was. Just check the sources at dotnet / corefx, and you will see many classes you’re already familiar when using the .NET Framework.
While many parts of the framework are well known, there are also many new parts like a built-in dependency injection framework as well as a new way to do the configuration, new logging interfaces… You can use these new types from existing applications.
You can use .NET Core libraries such as the new Microsoft.Extensions.DependencyInjection from the desktop .NET Framework, such as WPF applications.
ASP.NET Core is one of the best reasons to move to .NET Core. With ASP.NET Core you can use either the full .NET Framework (for easier migrations), or .NET Core. Using ASP.NET Core, while you can use the old Framework, you never use the older ASP.NET types. For example, if you created an ASP.NET filter you need to convert it to bring it to the new platform.
Rich Lander has a good advice in the comments of .NET Core Roadmap on when to use ASP.NET Core:
- Move to 1.0 for existing ASP.NET apps that you want to migrate to Linux and/or macOS in the short term
- Consider 1.0 for new apps, particularly if you appreciate the cross-plat and deployment benefits.
- Experiment with 1.0 to prepare apps that you think will be good candidates when adopting .NET Core becomes easier.
I fully agree with that. With new apps you also need to check frameworks that you are dependent on, whether these are available for .NET Core.
With ASP.NET Core 1.0 and ASP.NET MVC you not only get multi-platform support, but also a modern framework that’s flexible and can be easily extended.
There are good reasons to use ASP.NET Core today. New versions of my Websites are built with ASP.NET Core. There are also good reasons to stay on previous ASP.NET versions with existing applications.
Entity Framework Core
Entity Framework Core 1.0 is a new version of Entity Framework. This framework is not yet a complete replacement for Entity Framework 6. In case you need this framework to access databases on Non-Windows platforms, or accessing NoSQL storages, you should definitely have a look into it. Accessing a relational database on Windows, you need to be aware that Entity Framework Core 1.0 doesn’t have all features yet that are covered by Entity Framework 6.
Entity Framework Core 1.0 allows for new scenarios such as accessing databases on Non-Windows devices, and also from Universal Apps. However, it doesn’t offer all features available with Entity Framework 6 yet.
With .NET Core we have a new runtime. Of course, this is open source as well. Applications can be published without the runtime which requires the runtime to be available on the system (portable application), or the runtime can be published as a part of the application (self-contained application). With this, the runtime itself is available as a NuGet package.
The runtime can be distributed with the application, or it can be installed with the system.
The .NET Standard Library is a specification that defines which APIs are available on all .NET runtimes. Comparing this with the specifications of the portable library, the .NET Standard offers an easier way going forward. Portable libraries can also be converted to use the .NET Standard instead. See my article Portable Library, you’ll not be missed.
With the .NET Standard, you can use .NET Core Libraries from WPF and Windows Forms applications as well.
The .NET Standard is a new specification for .NET APIs that allows creating libraries for all .NET Clients, no matter if they use the .NET Framework or .NET Core
.NET Core Tools
With .NET Core we also have new command-line tools, the .NET Core command-line (CLI) tools. dotnet new to create a new project, dotnet restore to restore NuGet packages, dotnet build to compile the application, and dotnet run to run the application. Unit testing is also included with the dotnet tools, dotnet test runs the test with any configured test provider.
The dotnet tools can also be extended what you can see with Entity Framework Core dotnet ef, managing user secrets dotnet user-secrets, and others.
The .NET Core command-line (CLI) tools are easy to work with, you just have to remember dotnet.
.NET Core 1.0 started a new generation for .NET. Libraries can already be used from existing .NET applications. With many Web applications it already makes sense switching to the new ASP.NET Core framework.
.NET Core also gives new options where to run the application, and how the runtime can be distributed.
New tools offer easy ways to start building applications from the command-line.
Have fun with programming and learning!
The best way to start with .NET Core is either by my book or my workshops:
A new beginning: image from © Rfischia | Dreamstime.com A new beginning