This year's MS Build, even though online, was another good delivery from Microsoft. We saw announcements from their various products like Teams, Windows, Azure and also .NET. In this post, I highlight some of the major releases around .NET.
Build is Microsoft's annual developer conference. This year's event was delivered in a slightly different approach. It is normally an in-person event held in a large center with thousands of attendees, but this year's event was held online because of the global pandemic issue. Even with it being online, it wasn't short on exciting news and releases. I was interested in what is to come for .NET developers and the broader community—that's what I'll be sharing in this post and some later ones. This post will be focused on announcements, which I think are important to know for .NET developers.
Some months back, Microsoft talked about their plans to unify .NET Core and Mono/Xamarin implementations of .NET. The first step to achieving this is with .NET 5, and later .NET 6 which will include a complete union of .NET Core and Xamarin. For .NET 5, we expect to see some performance improvement, reduction in container image size, a new target framework, and the release of C# 9 and F# 5.
.NET 5 will have a lesser container image size and implement new APIs that will enable .NET to stay up-to-date with container runtime evolution.
There's a new approach to specify the target framework in .NET 5. The aim is to simplify how we use Target Framework Moniker (TFM) and make it easier to expose operating-system-specific APIs. This is because there will be one implementation of .NET and there won't be any need to specify which version of .NET Standard you're supporting. Instead, you'll have net5.0
or net6.0
to specify which version of .NET you're supporting. You’ll be able to use specific operating system APIs through some extensions of the framework by specifying something like net5.0-windows
to gain access to Windows-specific APIs or net6.0-android
for android specific APIs. Thus, net5.0
is the TFM for .NET 5 and it supports .NET Framework compatibility mode. Windows-specific functionality, like Windows Forms and WPF, will be exposed through net5.0-windows
.
Xamarin will be integrated as part of .NET 6, which will use net6.0
as its TFM. .NET 6.0 is where the complete vision for one .NET will be fulfilled.
C# 9 will be shipped with .NET 5. It includes a lot of new features and better support for immutable data representation. There's improved pattern matching, init-only properties, Records, and much more. You can choose to write your main program at the top level instead of having to write extra boilerplate code. The primary goal is to allow C# programs without unnecessary boilerplate around them, for the sake of beginners and the clarity of code. Here's an example:
using System;
Console.WriteLine("Hello World!");
This would be the same as writing:
using System;
class Program
{
static void Main()
{
Console.WriteLine("Hello World!");
}
}
There was a short demo on how you can do this as well for ASP.NET Core, and I think with top-level programs it would take a few lines of code to run a microservice or serverless function. There'll be more improvements than were demoed in the talk, but it looks very promising.
You can read more about C# 9 and more examples in the MS blog.
Microsoft announced the release of Windows Forms designer for .NET Core as preview in Visual Studio 16.6. To use the designer, you have to enable it by going to Tools > Options > Environment > Preview Features and select the Use the preview Windows Forms designer for .NET Core apps option.
The new designer only works on Windows 10 for now. All designer functionality and Windows Forms controls are available except for the DataGridView
and ToolStripContainer
controls. There's also a new WebView2
control, and you can find a getting started tutorial in the Microsoft documentation if you want to try it out.
Microsoft is also working with third-party control vendors so that their controls will show up in the designer toolbox.
.NET Multi-platform App UI (.NET MAUI) was introduced during the conference. It is a way to build cross-platform native UI in a single project. Building cross-platform mobile apps currently requires you to have a separate project for the target OS and some shared libraries. With .NET MAUI, you have one project that you can build and deploy to multiple devices. This is a cool evolution to Xamarin.Forms, and you can watch the demo in this video (skip to 1:13:00). The plan is to release a preview of this by the end of the year and release it as part of .NET 6.
Blazor WebAssembly was officially released and ready for production use. This means that you can run your .NET code in the browser, through WebAssembly. WebAssembly is designed to complement and run alongside JavaScript, and you can load WebAssembly modules into a JavaScript app and share functionality between them. This means that your C# code can run side by side with your JavaScript code, and you can now build full-stack .NET applications.
The Build session on Modern Web UI with Blazor WebAssembly showed Blazor WebAssembly features in action. One cool thing I personally like is that I can build progressive web applications with it. If you want to read more about the exciting features in this release, check out our other post, and be sure to check out the Telerik component library for Blazor apps. The suite provides rich components that you can use to enrich your apps and build rich web applications. It supports the latest 3.2.0 release!
Visual Studio 2019 for Mac (version 8.6 ) was released and it includes features support for Blazor WebAssembly, building gRPC projects, and an integrated terminal. As someone who uses VS Code and the integrated terminal in it without switching to a different app or window if I need to use the terminal, I find this to be my favorite feature in this release. It includes multiple instance support and configurable fonts, and nice integration with the Mac terminal.
This year's event, even though online, was another good delivery from Microsoft. A lot of announcements, but here I just focused on parts I think will be important for most .NET developers. We can see a clear vision toward unifying .NET as well as interesting language improvements for C# and F#. With the advancement in WebAssembly with Blazor, we can build full-stack .NET web applications. Some of these language features are released as part of .NET 5 preview 4, and you can try them out today.
Peter is a software consultant, technical trainer and OSS contributor/maintainer with excellent interpersonal and motivational abilities to develop collaborative relationships among high-functioning teams. He focuses on cloud-native architectures, serverless, continuous deployment/delivery, and developer experience. You can follow him on Twitter.