Microsoft & .NET.NET.NET Core 3.0 and Visual Studio 2019

.NET Core 3.0 and Visual Studio 2019

The .NET Core is a free and open-source managed computer software framework for Windows, Linux, and macOS. .NET Core supports cross-platform scenarios such as ASP.NET Core Web apps, command-line apps, libraries, and universal Windows platform apps.

The .NET Core 3.0 supports WinForms (Windows Forms), WPF (Windows Presentation Foundation), as well as ML .NET (Microsoft’s open-source machine learning framework) and IoT (Internet-of-Things).

Installing .NET Core 3.0

Installing .NET Core 3.0 is quite easy. We need to perform the following steps:

  1. Navigate to the this link and choose the desired .NET Core 3.0 version.
  2. Figure 1 displays the contents of the .NET Installer Web page:

    .NET Core 3.0 download
    Figure 1: .NET Core 3.0 download

  3. After it is downloaded, launch the installer, as shown in Figure 2:

    Launch installing .NET Core 3.0
    Figure 2: Launch installing .NET Core 3.0

  4. The .NET Core 3.0 is now installed.

The .NET Framework 4.8

Apart from the inclusion of the new C# 8.0 features, the inclusion of the .NET Framework 4.8 into .NET Core 3.0 is probably the most important feature. We can expect the following improvements (and more) in the .NET Framework in the form of the .NET Framework 4.8.

  • High DPI (dots per inch) improvements: Every day, the resolution of the displays is increasing to 4K (3840 x 2160 pixels or 4096 x 2160 pixels) and 8K (7680 × 4320 pixels) resolutions. The .NET Framework ensures that our existing Windows Forms and WPF applications still look great on these displays.
  • Touch and UWP controls access: UWP (Universal Windows Platform) contains new controls that take advantage of all the latest Windows features and touch displays. This means that we will not need to rewrite our apps to use these new controls and features.
  • Modern browser and media controls: New controls are being added to replace the older controls that still make use of the legacy Web and media technologies and are incompatible with the latest Web changes or media outputs, codecs and formats.
  • Performance: Apart from fixing small issues with the memory usage on the AsyncLocal and spin locks, a notable improvement includes a fix that ensures SqlDataReader.ReadAsync performs asynchronously.
  • Deadlocks and race conditions: Many of the core libraries of the .NET framework still harbor race conditions (race hazard) and deadlocks. A race condition occurs when a system attempts to perform two or more operations at the same time, but cannot because the system only allows the operations to be done in a proper sequence correctly. A deadlock, in concurrent computing, happens when each member of a group is waiting for another member, including itself, to take a certain action, but neither takes an action. Concurrency-related issues are fixed in the .NET Framework 4.8.
  • Potential crash with concurrent calls to a new dynamic method in the CLR (Common Language Runtime).
  • Potential deadlock when calling the Dispose method on an EventSource in the CLR.
  • NetworkInformation.NetworkChange deadlock when there is a lock around NetworkChanged listener and user’s call back.
  • Race condition in AsyncResult that closes a WaitHandle before the Set method is called in WCF (Windows Communication Foundation).

Building Windows Applications with .NET Core 3.0

With .NET Core 3.0, we can build Windows desktop applications by using either Windows Forms or WPF for Windows 10. WPF and Windows Forms will have modern controls as well as fluent styling via the use of XAML Islands.

XAML Islands

XAML (eXtensible Application Markup Language) Islands enables developers to use new pieces of UI from the UWP on their existing Win32 applications. The benefit of using XAML Islands is that it allows us to modernize our apps gradually.

This is possible because Windows 10 supports hosting UWP controls inside the context of a Win32 Process, with the help of two new system APIs, which are as follows:

  • WindowsXamlManager
  • DesktopWindowXamlSource

WindowsXamlManager has two methods: Dispose and InitializeForCurrentThread. InitializeForCurrentThread initializes the UWP XAML framework inside the current thread of the Win32 desktop app, thus creating the UWP UI in the Win32 desktop app.

DesktopWindowXamlSource is the instance of the Island content. The DesktopWindowXamlSource API renders and gets its input from an HWND (Windows Handle), so it needs to know to which HWND it will have to attach to. The programmer is responsible for sizing and positioning the parent’s HWND. There is an easier option, which is to make use of the Windows community toolkit because it wraps these classes into an easy-to-use implementation for WinForms and WPF.

Any framework that exposes HWND is able to host an XAML Island. This means that we could theoretically have a Java or Delphi application hosting a Windows 10 UWP control, whether it is a simple button or a complicated custom control. With a wrapper for the HWND object, this is possible.

NuGet Packages

The easiest way to use an Island inside our apps is to use the NuGet packages Microsoft provides. At the time of writing, the following NuGet packages were available.

  • Microsoft.Toolkit.Wpf.UI.XamlHost: Provides the WindowsXamlHost class for WPF.
  • Microsoft.Toolkit.Wpf.UI.Controls: Provides wrapper classes for WPF controls such as the MediaPlayerElement and InkCanvas.
  • Microsoft.Toolkit.Forms.UI.XamlHost: Provides the WindowsXamlHost class for Windows Forms.
  • Microsoft.Toolkit.Forms.UI.Controls: Provides wrapper classes for Windows Forms controls such as the MediaPlayerElement and InkCanvas.

Windows Community Toolkit

We can integrate with XAML Islands by using the Windows community toolkit. It is a collection of helper functions, custom controls, and app services. The Windows community toolkit can be used to build apps for any Windows 10 device, including PC, Mobile, Xbox, IoT, and even HoloLens.

The Windows community toolkit is available as a Visual Studio NuGet package for new or existing C# and VB.NET projects.

Alternatively, we can download the Windows community toolkit sample app in the Windows store.

Creating an App Using XAML Islands

We have three options to create a Windows desktop app using XAML Islands and they are as follows:

  • In the Developer Command Prompt, enter the following: dotnet new wpf.
  • In the Developer Command Prompt, enter the following: dotnet new winforms.
  • Open Visual Studio 2019 and choose any one of the new templates.

The new project types are mostly the same as the existing .NET Core projects, with a few extra additions.

MSIX Deployment for Desktop Apps

MSIX is a new packaging format based on the .msi installer, .appx installer, App-V, and ClickOnce installers. MSIX keeps the functionality of the existing app installer packages and installation files while enabling new and modern packaging and deployment features to Win32, WPF, and WinForm apps.


So many exciting things are going on! I hope you have enjoyed today’s article. For more information on .NET Core, you are welcome to have a read through my book.

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Latest Posts

Related Stories