Getting Started with the Uno Platform (Project Reunion/WinUI)

Two years ago I posted on Getting Started with Platform Uno which focused on starting with a UWP application and extending it cross platform using the Uno Platform. For those tracking developments in the Windows development space, you’ll be aware that the 0.5 version of Project Reunion has just been released. It seem fitting to … Continue reading “Getting Started with the Uno Platform (Project Reunion/WinUI)”

Two years ago I posted on Getting Started with Platform Uno which focused on starting with a UWP application and extending it cross platform using the Uno Platform. For those tracking developments in the Windows development space, you’ll be aware that the 0.5 version of Project Reunion has just been released. It seem fitting to do another Getting Started post, this time basing the application on a Project Reunion Windows UI application.

Installing Uno Platform (templates)

Let’s start by making sure we have the latest solution templates installed for creating a Uno cross platform application. Note that there are two different options for installing the Uno solution templates:

  1. Uno Platform Solution Templates – Visual Studio Marketplace
  2. Uno.ProjectTemplates.Dotnet

If you want to use UWP as the basis for your Uno application you should install the Visual Studio extension (i.e. option 1). If you want to use WinUI as the basis for your application, go with option 2, which is the “dotnet new” solution templates that you can install via command line.

dotnet new --install Uno.ProjectTemplates.Dotnet

Create the Solution

With the “dotnet new” solution templates installed, we can go ahead and create our application from the command line.

dotnet new unoapp-winui -o UnoReunionApp

You can then launch Visual Studio by opening the generated solution file (eg .\UnoReunionApp\UnoReunionApp.Sln).

Now all we need to do is build and run each of the target applications.

Android

Make sure the Droid application is set as start up project (in my case it already was the start up project), and then hit run. If you have a real device you can run it on that, alternatively you can run it in the emulator, which is what I’ve done.

iOS

Next, we’ll set the iOS project as that start up project. In order to run the iOS application you either need to use Visual Studio for Mac, or have use a remote connection to a Mac from Visual Studio (I typically use the latter). Make sure that you set the Solution Platforms dropdown to iPhone or iPhoneSimulator based on whether you want to use a real device or not. Also make sure the the run dropdown has the correct device, or simulator, selected.

If you’re using a remote connection, make sure the connection has been established to the Mac. Once you’ve done all this, you can hit the run button to launch the application. In this case I’m connecting to a remote MacBook and using the Remote Simulator on my Windows machine.

Note: If you’re using the preview edition of Visual Studio there are some known issues with building and deploying iOS applications. I’d recommend switching back to a stable build of Visual Studio.

MacOS and GTK

For this post I’m going to skip over these two platforms. For MacOS you have to open the solution using Visual Studio for Mac, set the MacOS as startup project and you should be good to go. For the GTK (i.e. Linux) project, you’ll need to follow the documentation provided by the Uno team for setting up your Linux environment.

Wpf

Set the Wpf.Host project as the startup project. Make sure that you pick either x64 or x86 as the Solution Platform and then hit the run button.

Wasm

For WebAssembly (WASM), set the Wasm project as the startup project. Hit the run button. There may be a long delay the first time you run the Wasm project as it needs to download the necessary components.

Windows

Finally, set the Windows.Package project as the startup project. Make sure the Solution Platforms dropdown is set to x86; AnyCPU and x64 won’t work as the build configuration isn’t correctly configured for this. Hit run button.

Summary

In this post I’ve shown you how easily you can create (using dotnet new) an application that runs across multiple platforms. This technology is simply awesome and with each release of Reunion/WinUI/Uno it’ll just get better and better.

4 thoughts on “Getting Started with the Uno Platform (Project Reunion/WinUI)”

    1. It will be – Reunion is very much v0.5 so there’s lots still to come. WinUI itself is quite mature, and the Uno support is amazing for cross platform apps. There are definitely some scenarios you’d want to validate before switching to this stack though.

Leave a Reply

Your email address will not be published. Required fields are marked *