Creating an app with VS Code

Note

Make sure to setup your environment by following our instructions.

Create the App

In a terminal, type the following to create a new project using dotnet new templates:

dotnet new unoapp -o MyApp --preset=blank -platforms android ios maccatalyst wasm gtk --vscode
Tip

MyApp is the name you want to give to your project.

This will create a blank template app that only contains the WebAssembly, Skia+GTK and Mobile platforms support.

Important

Mobile targets cannot be built under Linux. If you are using Linux, you'll need to remove android ios maccatalyst from the platforms list. The previous command would become dotnet new unoapp -o MyApp -preset=blank -platforms wasm gtk --vscode.

Next, open the project using Visual Studio Code:

  • In the terminal type the following:

    code ./MyApp
    
  • Visual Studio Code might ask to restore the NuGet packages. Allow it to restore them if asked.

  • Once the project has been loaded, in the status bar at the bottom left of VS Code, MyApp.sln is selected by default. Select MyApp.Wasm.csproj, MyApp.Skia.Gtk.csproj or MyApp.Mobile.csproj instead.

Debug the App

Uno Platform provides integrated support for debugging your app on Windows, mac and Linux.

  1. In the debugger section of the activity bar select Debug (Chrome, WebAssembly)
  2. In the status bar, ensure the MyApp.Wasm.csproj project is selected - by default MyApp.sln is selected.
  3. Press F5 to start the debugging session
  4. Place a breakpoint inside the OnClick method
  5. Click the button in the app, and the breakpoint will hit

You're all set, and don't forget to take a look at our Hot Reload feature!

You can also find additional VS Code topics, such as using snippets, updating existing apps to use VS Code

Explore

Next, explore the Uno Platform App solution structure.

Troubleshoot Issues

You may encounter issues while developing your app. Please see Common Issues we have documented.

Next Steps

Now that you have built your first application, you can head to our tutorials on how to work on your Uno Platform app.