.NET Desktop Application Development - A Summary

Photo by Andrew Neel on Unsplash

.NET Desktop Application Development - A Summary

.NET Desktop Development

Hello Hashnoders!

This is my first time, writing an article on Hashnode & please forgive me if it's not in the standard you expect.

Recently, I went through a course on Pluralsight called .NET 6 Desktop Development: Big Picture by Thomas Claudius Huber which is a pretty solid introductory course for choosing the right framework from the plethora of Desktop Development tools provided by Microsoft for .NET. Inspired by the way that the course was structured and the highly coherent narrative of the author, I planned to summarize my learnings in this article.

.NET Desktop Applications Development:

.NET Desktop application development could be classified into two:

  1. .NET Windows Desktop Applications Development

  2. .NET Cross-Platform Applications Development

.NET Windows Desktop Applications Development:

  1. WinForms

  2. WPF

  3. UWP

  4. WinUI Framework

WinForms/Windows Forms:

  1. Was part of .NET 1.0 developed way back in 2002

  2. Makes use of the GDI+(Graphical Design Interface) & Win32 API baked into the Windows Kernel on top of the Microsoft Windows Operating System

  3. Uses C# language for building UI components

  4. Because of Win32 API, WinForms have permission to access the files/folders of Microsoft Windows OS

  5. The GDI+ & Win32 leverage the capabilities of the CPU(Central Processing Unit) of the system to present the UI in WinForms

WPF/Windows Presentation Foundation:

  1. Was part of .NET 3.0 developed in 2006

  2. Makes use of a native component called MILCore(Media Integration Layer Core) & DirectX, which is a framework that makes use of the computer's GPU(Graphics Processing Unit) for drawing the controls

  3. Uses XAML(extensive Application Markup Language) for building UI Components & makes use of an architectural pattern called MVVM(Model View View Model)

  4. Similar to WinForms, WPF sits on top of the Win32 API having permission to access the files/folders of Microsoft Windows OS

  5. Visual Studio itself is an example of a WPF application

WPF & WinForms have been ported to .NET Core 3.0 framework which was developed in 2016. .NET Core framework is developed as an open-source framework by Microsoft to be able to develop & run applications across multiple platforms.

UWP/Universal Windows Platform:

  1. UWP for Windows development was baked into Windows 10 OS that runs on top of the Windows RT(Window RunTime)

  2. UWP uses the XAML UI Framework & XAML Controls for developing Windows applications

  3. UWP hosting model is a sandbox environment with restricted access to Microsoft Windows OS files/folders & each access should be written as part of the UWP application itself

  4. UWP applications could be written using .NET or C++

  5. UWP applications are only meant for Microsoft Windows 10 OS

WinUI Framework/Windows User Interface Framework:

WinUI 2.x:

  1. UWP applications use XAML controls that are tightly coupled to the underlying newer versions of Microsoft Windows OS

  2. To decouple such a dependency, WinUI 2.x was introduced as a Nuget Package

  3. WinUI 2.x contains the XAML controls built-in, so that the UWP applications can leverage this functionality

WinUI 3:

  1. WinUI 3 framework was introduced as a NuGet package with XAML UI Framework & XAML controls built-in

  2. WinUI 3 could be leveraged by WPF & WinForms to modernize the applications

  3. UWP applications could not use WinUI 3 as they are dependent on the XAML framework that's baked into the Microsoft Windows 10 OS

  4. WinUI 3 is the native UI framework for Microsoft Windows 10/11 OS

  5. WinUI framework also uses the Win32 API for accessing files/folders of Microsoft Windows 10/11 OS

  6. Windows App SDK provides a unified API for developing applications on the Microsoft Windows 10/11 OS & WinUI 3 is a part of the Windows App SDK.

.NET Cross-Platform Application Development Tools:

  1. Xamarin

  2. .NET MAUI

  3. Blazor

  4. Open Source Frameworks(Avalonia & Uno Platform)

Xamarin(Before .NET 6):

  1. With the advent of .NET 1.0 in 2002, another framework targeting Linux OS called Mono was developed in 2004

  2. Mono runtime makes use of the .NET BCL(Base Class Library) to develop .NET applications for Linux OS

  3. As iOS & android are based on the Unix kernel as with the Linux OS, Mono was ported to iOS & android as MonoTouch & Mono for Android respectively

  4. The makers of Mono, MonoTouch & Mono for Android founded a company in 2011, known as Xamarin

  5. Once the company was formed, MonoTouch was renamed Xamarin.iOS & Mono for Android was renamed to Xamarin.Android

  6. To unify the Xamarin development across platforms & to avoid the necessity to leverage native classes to achieve native functionality across platforms, Xamarin.Forms were developed in 2014

  7. Xamarin.Forms also support UWP

  8. Xamarin uses XAML & .NET for application development

  9. With Xamarin.Forms, it became possible to develop applications across iOS, Android & Windows

.NET MAUI/.NET Multi-Platform Applications User Interface(Since .NET 6):

  1. Microsoft acquired Xamarin in 2014

  2. Post the release of .NET 6 in 2021, the capabilities of Xamarin.Forms are extended by .NET MAUI

  3. .NET MAUI supports development for targeting iOS, Android, Windows & MacOS

  4. Xamarin.iOS was renamed to .NET for iOS & Xamarin.Android was renamed to .NET for Android

  5. Instead of UWP which had its limitations, .NET MAUI supports the WinUI library

  6. .NET MAUI also uses XAML & .NET for application development

Blazor:

Blazor is Microsoft's framework for building interactive client-side web applications in .NET

Blazor Classification:

  1. Blazor WebAssembly

  2. Blazor Hybrid

Blazor WebAssembly:

  1. Blazor WebAssembly is meant for developing UI components in HTML/CSS with logic in .NET making use of the Blazor framework across platforms

  2. Blazor WebAssembly runs on the .NET runtime of WebAssembly which is a binary instruction format supported by all modern browsers

  3. Blazor WebAssembly runs on the browser element which could be hosted on the Desktop application

  4. WebAssembly is a sandboxed runtime that has restrictions to the OS access

Blazor Hybrid:

  1. Rather than running on the WebAssembly, the Blazor applications could be running on BlazorWebView to leverage the underlying .NET runtime running on top of the OS

  2. This setup is referred to as the Blazor Hybrid as we have a web application (i.e.) Blazor which is hosted within a Desktop application

  3. We have multiple tools that support Blazor for developing desktop applications like .NET MAUI, WPF & WinForms

Open Source Frameworks:

We have 2 popular open-source frameworks for supporting .NET cross-platform application development:

  1. Avalonia

  2. Uno Platform

    Avalonia:

    Avalonia is an open-source framework which is an extension of WPF leveraging XAML for cross-platform development

    Uno Platform:

    The Uno platform does not provide options for cross-platform development per se but compiles an existing Windows application, to be able to port it into other platforms

Which framework to use for Desktop Application Development?

It all boils down to the scenario & skill set when it comes to choosing the framework that works for Desktop Application Development.

Please refer below:

Windows Platform:

Skills:

XAML

Tools:

WPF, WinUI

Skills:

.NET

Tools:

WinForms

Cross-Platform:

Skills:

XAML

Tools:

.NET MAUI, Xamarin, Avalonia, Uno Platform

Skills:

HTML/CSS, .NET

Tools:

Blazor