Get Started on Visual Studio For Mac
While it is easier to create apps using Uno Platform on Windows, you can also create all but UWP/WinUI apps on your Mac.
Prerequisites
- Visual Studio for Mac 8.8
- Xcode 10.0 or higher
- An Apple ID
- .NET Core SDK
- .NET Core 3.1 SDK (version 3.1.8 (SDK 3.1.402) or later)
- .NET Core 5.0 SDK (version 5.0 (SDK 5.0.100) or later)
- GTK+3 for running the Skia/GTK projects
Installing the dotnet new templates
- In order to create a new Uno Project, you'll need to install the
dotnet new
Uno Platform templates. - Once done, in Visual Studio for Mac, open the preference menu:
- On left side, open the Other then Preview Features menu
- Check the Show all .NET Core templates in the New Project dialog
Create a new project using the IDE
To create a new project:
- Click the New button on the welcome screen
- Select Cross Platform App (Uno Platform)
- If presented with a list of options, uncheck Skia/WPF
- Choose a name then click create
Once created, you should see your folder structure set up like this:
\
- If you have a warning symbol on your iOS project, make sure you have the minimum version of Xcode installed.
To update, go toVisual Studio > Preferences > Projects > SDK Locations > Apple
and select Xcode 12 or higher. Restart Visual Studio.
- If you have a warning symbol on your iOS project, make sure you have the minimum version of Xcode installed.
If you did not get presented a list of options to create the project, as of Visual Studio for Mac 8.8, the Uno Platform template contains WPF projects that prevent NuGet restore to work properly. To fix this:
- Select the
MyProject.Skia.Wpf
andMyProject.Skia.Wpf.Host
- Right click to remove them from the solution.
- At the top of the tree, on the solution node, right click and select Restore Nuget Packages
- Select the
You can now run on iOS, Android, and macOS by setting your startup project and running.
Note: You will not be able to build the UWP and WPF projects on a Mac. All changes to this project must be made on Windows.
Create a new project using the command line
You can create a new Uno Platfom solution with the following terminal command:
bash dotnet new unoapp -o MyProject --skia-wpf=false
Once created, you can open it using the Visual Studio IDE.
Build and Run for WebAssembly
Building for WebAssembly takes a few more steps:
- Set
MyProject.Wasm
to startup project - Build the project
- In the terminal, navigate to your build output. This will typically be:
MyProject.Wasm > bin > Debug > netstandard2.0 > dist > server.py
Run theserver.py
program. - In your browser, open localhost:8000.
Video Tutorial
Getting Help
If you have issues with Visual Studio and Uno Platform, please visit our Discord - #uno-platform channel or StackOverflow where our engineering team and community will be able to help you.