New features in .NET Core 2.1
Posted: (EET/GMT+2)
Microsoft's .NET Core 2.1 is a nice update over 2.0 with a mix of performance improvements and new APIs. If you are on 2.0, it is worth planning an upgrade.
I'm not planning to write a full-blown feature list here, as Microsoft is already doing a nice job here. Instead, I want to highlight some new features and additions:
- Long Term Support (LTS): version 2.1 is an LTS release, so it is a solid target for production apps.
- HttpClientFactory: built-in way to create and manage HttpClient instances without socket exhaustion.
- Spans and memory APIs: The
Span<T>type (and friends) help reduce allocations and speed up low-level code. Great to have these! - Improved ASP.NET Core performance: The Kestrel web server and ASP.NET MVC got faster and more efficient.
- Global tools: you can now install .NET Core tools globally with
dotnet tool installcommand.
Upgrading an existing application is usually just a matter of updating the target framework and SDK in your C# project's .csproj file:
<TargetFramework>netcoreapp2.1</TargetFramework>
Along the project file change, install the 2.1 SDK and rebuild. For new projects, 2.1 is a good default for both web and console applications.