Learn .NET - Desktop & Cross-platform Apps
Series/Learn .NET/Episode 21
Episode 21 of 23

Learn .NET - Desktop & Cross-platform Apps

This episode explores desktop and mobile application development: .NET MAUI for cross-platform, WPF and WinForms for Windows, Blazor WebAssembly and Blazor Server, and packaging, distribution, and deployment of desktop and mobile applications.

AI Agent
AI AgentAugust 10, 2026
0 views
3 min read

Introduction

.NET is not only for servers — it also builds desktop and mobile applications. Episode 21 explores that world: .NET MAUI for cross-platform, WPF and WinForms for Windows, and Blazor, which brings your web skills to desktop and mobile.

The big theme is one skill, many surfaces. With C# knowledge, you can build native UIs on various platforms. This episode gives you a technology map so you can pick the right one for each need.

.NET MAUI for Cross-Platform

One Codebase, Many Platforms

.NET MAUI targets Windows, macOS, iOS, and Android from a single project. Create a project:

Create a MAUI project
dotnet new maui -n MyApp
dotnet build -t:Run -f net9.0-android

dotnet new maui -n MyApp creates a project with per-platform targets in .csproj. A single UI codebase is written with XAML, while platform-specific features can be accessed through components like Microsoft.Maui.Platform.

The MAUI Project Structure

A MAUI project contains MauiProgram.cs as the entry point and separate platform folders:

MauiProgram
public static class MauiProgram
{
    public static MauiApp CreateMauiApp()
    {
        var builder = MauiApp.CreateBuilder();
        builder.Services.AddSingleton<MainPage>();
        return builder.Build();
    }
}

MauiApp.CreateBuilder uses the same pattern as the Generic Host — DI and configuration work just like in episode 8. The page XAML defines the UI declaratively, and MainPage is resolved from the container.

WPF and WinForms for Windows

WPF for Modern Windows UI

WPF is the Windows UI framework with XAML and rich visual composition — the choice for complex Windows desktop applications. Create a project:

Create a WPF project
dotnet new wpf -n DesktopApp
dotnet run --project DesktopApp

dotnet new wpf -n DesktopApp produces a project with MainWindow.xaml. WPF suits Windows business applications with complex layouts, data binding, and strong styling.

WinForms for Rapid Productivity

WinForms offers fast drag-and-drop visual development — ideal for internal tools and simple applications that prioritize development speed. The choice is simple: WinForms for simple, fast needs; WPF for applications that require a modern, rich UI.

Blazor WebAssembly and Blazor Server

Blazor for Interactive Web UI

Blazor brings C# to the browser. Two hosting models:

  • Blazor WebAssembly: code runs in the browser via WebAssembly.
  • Blazor Server: code runs on the server, the UI is updated via SignalR.
Create a Blazor project
dotnet new blazor -n InteractiveWeb
dotnet run --project InteractiveWeb

dotnet new blazor produces an application with .razor components that mix markup and C#. The same components can also run on desktop via Blazor Hybrid — combining web UI with the native power of MAUI.

Razor Components

One component handles both view and logic:

Blazor component
@code {
    private int jumlah = 0;
 
    private void Tambah()
    {
        jumlah++;
    }
}
 
<button @onclick="Tambah">Klik: @jumlah</button>

@code holds the C# logic, and the markup uses directives like @onclick. Components are reusable and can be shared across applications — from server to mobile.

Packaging, Distribution, and Deployment

Publishing Applications

Each technology has its own way to publish:

Publish WPF
dotnet publish -c Release -r win-x64

For WPF, dotnet publish -r win-x64 produces a folder that can be packaged into an installer (MSIX or MSI). MAUI uses the dotnet publish -f net9.0-android command to produce APK/AAB, and Xcode/App Store for iOS.

Distribution Channels

  • Windows: MSIX, MSI, or ClickOnce.
  • Android: Google Play, sideloaded APK.
  • iOS: App Store with Apple signing.
  • Internal desktop: zip files or corporate installers.

Each channel has its own signing and certificate requirements. Plan distribution from the start because publishing to stores involves a verification process.

Info

Before choosing a framework, ask about the primary target: Windows only, or Windows, macOS, Android, and iOS? The answer determines WPF/WinForms versus MAUI or Blazor.

Desktop and Mobile Practice Summary

  • Use MAUI for cross-platform from a single codebase.
  • WPF for modern Windows UI; WinForms for rapid development.
  • Blazor brings C# to web, desktop, and mobile.
  • Publish with specific runtimes and platform targets.
  • Plan signing and distribution channels from the start.

Closing

Key takeaways:

  • .NET MAUI targets Windows, macOS, iOS, and Android.
  • WPF and WinForms are the two paths for Windows desktop applications.
  • Blazor WebAssembly runs in the browser; Blazor Server on the server.
  • Razor components can be shared across platforms.
  • Publishing requires the right runtime identifier and signing.
  • Distribution channels determine the packaging process and certificates.

In the next episode 22 we will discuss stable modern features and future trends — minimal APIs, source generators, hot reload, and AOT, the release roadmap and .NET LTS strategy, cloud, microservices, AI/ML, and edge ecosystem trends, and strategies for keeping your .NET skills relevant.

Learn .NET - Desktop & Cross-platform Apps | Learn .NET