Skip to content

Latest commit

 

History

History
61 lines (45 loc) · 2.57 KB

get-started-vsmac.md

File metadata and controls

61 lines (45 loc) · 2.57 KB

Get Started on Visual Studio For Mac 2022

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

[!includegetting-help]

Installing the dotnet new templates

In order to create a new Uno Project, you'll need to install the dotnet new Uno Platform templates.

Create a new project using the IDE

  1. To create a new project, from the command line:

    cd src
    dotnet new unoapp -o MyApp01
    
  2. Once created, open the MyApp-vsmac.slnf file

    • This slnf is called a solution filter, which automatically excludes projects which are not compatible with Visual Studio for Mac 2022.
    • If you have a warning symbol on your iOS project, make sure you have the minimum version of Xcode installed. update-xcode\

To update, go to Visual Studio > Preferences > Projects > SDK Locations > Apple and select Xcode 13.3 or higher. Restart Visual Studio.

  1. You can now run on iOS, Android, macOS, and Skia.GTK projects by changing your startup project and starting the debugger.

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.

Important

As of .NET 6 Mobile RC3, the macOS head can fail to build with issues related to the AOT compiler. You can run the Catalyst app on a mac.

Create other projects types using the command line

You can create a new Uno Platfom solution with the following terminal command: bash dotnet new unoapp -o MyProject --wasm=false

Once created, you can open it using Visual Studio for Mac 2022.

Build and Run for WebAssembly

Building for WebAssembly takes a few more steps:

  1. Set MyProject.Wasm to startup project
  2. Build the project
  3. In the terminal, navigate to your build output path. This will typically be: MyProject.Wasm > bin > Debug > net6.0 > dist
  4. Install dotnet serve:
    dotnet tool install -g dotnet-serve
    
  5. Once installed type dotnet serve (or ~/.dotnet/tools/dotnet-serve).
  6. Navigate to the URL presented by the tool to run your application

[!includegetting-help]