-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Creating Cross-Platform C# Applications with Uno Platform
By :

Now that you are familiar with Uno Platform, you're undoubtedly eager to begin writing code. We'll start that in the next chapter, but you'll need to set up your development environment before we can begin.
Visual Studio is the most popular Integrated Development Environment (IDE) for developing Uno Platform apps. A large part of this is because it has the broadest set of capabilities and the best support for building UWP apps.
To build apps with Uno Platform using Visual Studio, you will need to do the following three things:
The many tools, libraries, templates, SDK, and other utilities that can be installed as part of Visual Studio are collectively called components. With over 100 components available, related components are grouped into workloads to make it easier to choose what you need. You select workloads in the Visual Studio Installer, and these are shown in Figure 1.4:
Figure 1.4 – The Visual Studio Installer showing various workload options
To build apps with Uno Platform, you'll need the following workloads installed:
To make it easier to build your Uno Platform applications, multiple project and item templates are available. These are installed as part of the Uno Platform Solution Templates extension. You can install this from within Visual Studio, or directly from the marketplace.
To install the extension containing the templates, perform the following actions within Visual Studio:
Uno
. It should be the first result.Figure 1.5 – Uno Platform Solution Templates shown in the Manage Extensions dialog
Follow these steps to install the extension from the marketplace:
Uno
. It should be the first result returned.Alternatively, go directly to the following URL: https://marketplace.visualstudio.com/items?itemName=nventivecorp.uno-platform-addin.
.vsix
file to start the install wizard.With the workloads and templates installed, you're now ready to start building apps. However, if you want to develop for iOS or Mac, you'll also need a Mac device set up so that you can connect to it from Visual Studio on Windows.
It's not compulsory to use Visual Studio 2019 on a Windows PC, and the Uno Platform team has worked hard to make building Uno Platform apps as flexible as possible. Therefore, you can use it within your existing working patterns and preferences.
In addition to working with the templates inside Visual Studio, it's also possible to install them for use from the command line. To install them this way, run the following at the command line or terminal:
dotnet new -i Uno.ProjectTemplates.Dotnet
After this command has finished, it will list all the available templates. You should see multiple entries with a short name, beginning with uno.
To build Uno Platform apps using Visual Studio for Mac, you will require the following:
Links to all these are available at the following URL: https://platform.uno/docs/articles/get-started-vsmac.html.
You can use Visual Studio Code to build WebAssembly apps on Windows, Linux, or Mac. Using it to build apps for other platforms is not yet supported.
To build Uno Platform apps using Visual Studio Code, you will need the following:
Links to all these are available at the following URL: https://platform.uno/docs/articles/get-started-vscode.html.
It is possible to use JetBrains Rider on Windows, Mac, and Linux, but not all platforms can be built for with all versions.
To build Uno Platform apps with JetBrains Rider, you will need the following:
There are some additional points to be aware of when using JetBrains Rider, as follows:
Links to all these and more details are available at the following URL: https://platform.uno/docs/articles/get-started-rider.html.
Important note
It is also possible to use Blend for Visual Studio (on Windows) to work with code as you can for regular UWP apps. However, Blend does not support all the project types that an Uno Platform solution contains. You may find it beneficial to have a separate version of the solution that doesn't include those projects, and access that version in Blend.
Uno Platform has a dotnet global tool to check if your machine is set up correctly and walk you through addressing any issues it finds. It's called uno-check and it's very simple to use, as follows:
dotnet tool install --global Uno.Check
uno-check
Whichever IDE or code editor you use, there will be many parts, and the use of multiple tools, SDKs, and even machines can make it hard to know where to begin when things aren't working. The following are general tips to help work out what isn't working. Some of these may seem obvious, but I'd rather look a fool for reminding you to check something obvious than have you waste time on an unchecked assumption:
Trying equivalent actions or creating equivalent apps with other tools can often produce different error messages. In addition, you may also find paths to solutions that fix problems in your Uno Platform project setup:
Xamarin.Forms
apps?Additional tips for resolving common setup and configuration issues can be found at the following two URLs:
If the issue comes from connecting to a Mac from a PC, the Xamarin documentation may be helpful. It is available at the following URL: https://docs.microsoft.com/en-us/xamarin/ios/get-started/installation/windows/connecting-to-mac/. This can also help identify and address the issue in Uno Platform projects as well.
Details on where to go for answers to specific Uno Platform-related questions can be found in Chapter 8, Deploying Your Apps and Going Further.
Change the font size
Change margin width
Change background colour