This article is more than 1 year old
First effort to unify sprawling .NET estate nearly done with 5.0 set for November release
But long-term support won't arrive until 6.0 towards end of 2021
Microsoft has dished out the last preview of .NET 5.0, saying it is feature-complete ahead of general availability in November.
This is a big release that promises to be a unified platform for all .NET applications (including those that previously required .NET Framework.)
.NET 5.0 enables desktop Windows applications, built with Windows Forms or Windows Presentation Foundation (WPF), to be coded with the cross-platform version of .NET, hitherto called .NET Core, though these remain Windows-only frameworks. Other changes include single file applications, support for Windows on ARM64, support for targeting WebAssembly (though still using the Mono runtime), the introduction of C# 9.0 and F# 5.0, new versions of ASP.NET Core and Entity Framework Core, and performance improvements.
The next step, according to program manager Richard Lander, will be two go-live release candidates before November's full launch. However, .NET 5.0 is not a long-term support (LTS) release. In that respect, the big one is .NET 6.0, planned for November 2021. Microsoft intends to update .NET LTS every two years.
The .NET 5.0 SDK comes with the new desktop runtime and ASP.NET Core 5.0, as well as C# 9 and F# 5. And of course telemetry, which is on by default
There are a few snags and compromises. A change to the way .NET interops with WinRT (the runtime used for modern Windows 10 APIs) means that existing apps using these APIs will not run on .NET 5.0 without rebuilding. Windows desktop application support will not extend to ARM64, but will come later in a servicing update. ClickOnce support, used for deploying desktop applications on a network, is planned for .NET 5.0 but is not in this preview.
C# 9.0 has a bunch of new features including top-level programs (no main method required, making Hello World easier for beginners), record types, and target-typed
new. This last is an alternative to
var for reducing typing. Using
var, the type of a variable is inferred from its value, whereas target-typed
new infers what to type to create:
List<int> mylist = new();
var mylist = new List<int>();
The full list of what is new is here. Although every new feature has a rationale, there are dissenting voices who feel Microsoft has added too much to the language.
"What I'm after is less syntax, not more syntax. C# is already so vast, we'll arrive at a point where devs can't understand all code anymore, like with C++. That's bad," said .NET veteran Frans Bouma on Twitter.
Single-file applications are largely for Linux and include a statically linked .NET runtime in the executable. Microsoft is currently unable to do this on Windows "due to various operating system constraints", said Lander, though there is an alternative that packages the .NET runtime into a single file with the application, and unpacks them to a temporary directory for running.
Lander also discussed whether single-file applications qualify as native code compilation. "AOT [Ahead of Time] is a spectrum," he said. Single-file applications can generate machine code ahead of time, but do not qualify as "native AOT" because not everything is compiled to machine code. There is still hope for native AOT in .NET 6.0.
ASP.NET Core is updated with full integration for Azure Active Directory, the cloud directory used by Office 365, via a Microsoft.Identity.Web library. There are also updates aimed at Blazor WebAssembly, single-page web applications deployed as .NET compiled to WebAssembly. There are some updates to Razor, the template system in ASP.NET, to properly support C# 9.0.
Entity Framework (EF) Core, the official .NET object-database mapper, is also getting an update, with better support for SQLite and other improvements.
Accompanying the .NET updates is a new preview of Visual Studio 2019 16.8, the next version. Git repositories with more than one Visual Studio solution are now fully supported in the user interface, there is a new Extract Base Class refactoring, and several other tweaks.
Microsoft's .NET 5.0 is a huge effort to make sense of the problems caused when the company chose to split .NET into the Windows-only .NET Framework and the cross-platform .NET Core. It is a capable platform, but wresting the sprawl of .NET technologies into a unified set of frameworks remains a work in progress. ®