Additional setup for Linux or WSL

The Uno Platform for Linux current comes with a rendering backend using Skia, and a shell support with Gtk3.

It is possible to develop :

  • Using Visual Studio on Windows directly, or using the Windows Subsystem for Linux (WSL).
  • Using VS Code under Linux

Setting for Windows and WSL

Using VS 2019 16.6 or later:

  • Install WSL Ubuntu 18.04 or later
  • Install the prerequisites for Linux mentioned in the next section, in your installed distribution using the Ubuntu shell
  • On Windows 10, Install vcXsrv, an X11 server for Windows
    • You'll need to start the server in "Multiple windows" mode, starting with "no client" mode.
  • On Windows 11, Wayland is supported and nothing needs to be installed
  • Install the GTK3 runtime.
  • Using the WSL 1 mode is generally best for performance and ease of use for the X11 server
    • You can switch between versions of a distribution using wsl --set-version "Ubuntu-20.04" 1
    • You can list your active distributions with wslconfig /l and change the default with wslconfig /s "Ubuntu-20.04"
    • You can change the used distribution with the "distributionName": "Ubuntu-20.04" launch profile parameter of the VS WSL 2 Extension.
    • If you have a insider preview of Windows 10, you may use the wayland server.
    • If you still want to use WSL 2 anyways, you can try following those steps.
  • Install the dotnet new templates:
    dotnet new -i Uno.Templates
    
  • Then create a new project using:
    dotnet new unoapp -o MyUnoApp
    

Now let's run the application:

  • Open the solution using Visual Studio
  • In the debugger menu, next to the green arrow, select WSL (or WSL 2 depending on the visual studio version)
  • In the launch profile file, set:
"environmentVariables": {
    "DISPLAY": ":0",
    "GDK_GL": "gles", // use this line when running under WSL on Windows 11
},
  • Start the debugger session
  • Visual Studio may ask you to install .NET 6 and the Linux debugger, press OK and let the installation finish, then restart the debugging session.

Setting up for Linux

  • Install GTK3:
    sudo apt update
    sudo apt-get install gtk+3.0 mesa-utils libgl1-mesa-glx ttf-mscorefonts-installer
    
  • Install .NET 6

Finalize your environment

  1. Open a Terminal.
  2. a. Install the tool by running the following command from the command prompt:
    dotnet tool install -g uno.check
    
    b. To update the tool, if you already have an existing one:
    dotnet tool update -g uno.check
    
  3. Run the tool from the command prompt with the following command:
    uno-check
    
    If the above command fails, use the following:
    ~/.dotnet/tools/uno-check
    
  4. Follow the instructions indicated by the tool

You can find additional information about uno-check here.

Install the templates and create the application

  • Install the dotnet new templates:
    dotnet new -i Uno.Templates
    
  • Then create a new project using:
    dotnet new unoapp -o MyUnoApp
    

Now let's run the GTK based application:

  • Open the folder created by dotnet new
  • In the terminal, build and run the application:
    cd MyUnoApp.Skia.Gtk
    dotnet run
    

And run the WebAssembly head with: bash cd .. cd MyUnoApp.Wasm dotnet run

Getting Help

If you continue experiencing issues with Uno Platform, please visit our GitHub Discussions or Discord - #uno-platform channel where our engineering team and community will be able to help you.