Getting Started with Uno Platform and the Raspberry Pi

Uno Hello World


For this guide, you'll need various pieces of hardware and an Azure Account;

What we'll be doing

In this guide, we'll be setting up our Raspberry Pi to launch a "Hello World" Uno Application.

For this guide, we'll install all of the requirements to build and run the application directly on the Pi, but I will show you how to do this on your main machine at the end.

There will be a series of steps involved in this;

Connect to your Raspberry Pi

Before we go anywhere, let's make sure we can dial in to our Raspberry Pi.

You may need to do this part with a Keyboard, a Mouse and Monitor of course, unless you enabled SSH on the SD card before you installed Raspberry Pi OS.

Firstly, make sure that your Pi is connected to the same network.

We need to enable both SSH and VNC connections, so click the Raspberry Pi OS start button, then go to the Preferences sub menu and hit the "Raspberry Pi Configuration Item";

Raspberry Pi Configuration Menu Item

Next, click the Interfaces Tab, and make sure that SSH and VNC are enabled;

Raspberry Pi Configuration

Hit the Ok button, and accept the offer to reboot your Pi.

Update Raspberry Pi OS

Before we can do anything, assuming you've gotten your Raspberry Pi all set up, we need to make sure that everything is up to date.

Run the following two commands;

sudo apt update
sudo apt full-upgrade

Once those two commands have completed, restart your Pi using;

sudo reboot

Install .NET

Now that our Pi is all up to date, we're ready to install the .NET.

Normally for the Pi, as there's no apt-get install dotnet, we'd need to go through a bunch of steps to get .NET installed.

However, I've created a single line install script for .NET 7 on the Raspberry Pi.

Run the following command;

wget -O - | sudo bash

You can see the contents of this .NET installation script in on GitHub

Install .NET

Once the process has completed, go ahead and reboot your Pi again with;

sudo reboot

Once you're finished, you should be able to run the following to check your .NET version;

dotnet --info

.NET Installed

Install Uno Platform Templates

Next we can add the Uno Platform Project Templates to our .NET Installation;

dotnet new --install Uno.Templates

Install Uno Templates

Once the templates are installed, you can scroll back up and see the list of Uno templates that were installed;

Uno Templates Installed

Create a new Uno Solution

Now we have the moving parts installed on our Pi, we can spin up a brand new Uno solution with the following command;

dotnet new unoapp -o HelloPi && cd HelloPi

You should now find yourself in the solution directory for your new Uno App. If we have a look at the folder contents with;


Uno Templates Installed

The directory we're interested in is the HelloPi directory. This directory contains the project which we'll build and run on the Raspberry Pi.

Give the SSH Session access to use the display

Before we can launch our application, we need to give our SSH session access to the display.

If we don't do this, we'll get an error like;

Unable to init server: Could not connect: Connection refused

(HelloPi:18530): cannot open display:

We can sort this out using the following command:

export DISPLAY=:0

You won't get any response to this message, so don't worry.

You'll need to remember do this every time you launch a new SSH session currently, but don't worry too much about that for now.

Build and run the application

We're now ready to run our application.

Firstly, we need to navigate to the HelloPi directory;

cd HelloPi

We can now run our application with;

dotnet run -f net8.0-desktop

This will take quite some time to run this command the first time as the Pi isn't as powerful as a desktop PC of course.

You may also see some errors, but don't worry about those, as they're complaining that we're not running this from Visual Studio for XAML Hot reload to connect to.

To be able to see your app running, you're going to need to either connect a Monitor or VNC, but all being well, after a minute or so, you should see the Uno Hello World application running happily on your Pi;

Uno App Running

Creating and Building on a PC

We've performed most of this on the Pi itself of course. However, you can actually create and build the whole application on your PC and copy the built files to your Pi using;

dotnet publish -r linux-arm -o bin\linux-arm\publish --no-self-contained

You can copy the contents of the bin\linux-arm\publish directory to your Pi in whatever way takes your fancy.

You then need to navigate to the directory where you've copied the files and make the main application executable with;

chmod +x HelloPi

Don't forget that, if you've just dialled in you'll need to give access to the Display;

export DISPLAY=:0

If you are using a 64-bit version of the Raspberry Pi OS, you need to run the following commands to be able to run 32-bit executable :

sudo apt-get install ia32-libs-multiarch
sudo apt-get install ia32-libs

You can then run the application with;


See Developing UWP Apps for the Raspberry Pi with Uno Platform blog post for how you can actually automate Building, Deploying, and even debugging from your Windows machine using VS Code.

Wrap Up

With that, we've gotten our first Hello World application up and running on the Raspberry Pi.


Pete Gallagher