Back to Uno

Creating an app with Visual Studio

doc/articles/create-an-app-vs2022.md

6.6-release-branch-cut7.5 KB
Original Source

Creating an app with Visual Studio

[!NOTE] Make sure to setup your environment first by following our instructions.

Create the App

To create an Uno Platform app:

  1. Create a new C# solution using the Uno Platform App template, from Visual Studio's Start Page, then click the Next button


  2. Configure your new project by providing a project name and a location, check the "Place solution and project in the same directory" option, then click the Create button

    [!NOTE] If you intend to add your new project to an existing solution, continue this guide then follow our instructions.

  3. Choose a template preset to build your application

    [!TIP] For a detailed overview of the Uno Platform project template wizard and all its options, see this. [!NOTE] Starting with Uno.Sdk 6.0, Skia rendering is now the default rendering engine in Uno Platform templates for iOS/Android/WebAssembly. If you prefer native rendering instead, you can switch this setting in the Features tab under Renderer.

  4. Click the create button

  5. Ensure that the lower left IDE icon shows a check mark and says "Ready" . This ensures that the projects have been created, and their dependencies have been restored completely.

  6. A Windows Firewall window may appear. If you do not intend to do Linux development with WSL, check "Private networks" only. Otherwise, check "Public networks" and "Private networks".

  7. A banner at the top of the editor may ask to reload projects, click Reload projects:

  8. [!IMPORTANT] A notification should appear prompting you to sign in or register with Uno Platform.

    Signing in with your Uno Platform account in Visual Studio unlocks powerful tools like Hot Reload, helping you speed up development.

    With a single registration, you also gain early access to new features and the opportunity to connect with the Uno Platform community, where you can share feedback and network.

    Detailed information on registration and sign-in is available <a href="https://aka.platform.uno/account-access" target="_blank">here</a>.

Debug the App

Desktop

To debug your Uno Platform Desktop target:

  • Directly on Windows:

    • In the Debug toolbar drop-down, select the profile MyApp (Desktop)

    • Press F5 to debug.

  • Using WSL with X11:

    • In the Debug toolbar drop-down, select the profile MyApp (Desktop WSL2)

    • Then press F5 or the green arrow to start debugging the app

WebAssembly

To run the WebAssembly (Wasm) head:

  • In the debugger toolbar, click the down arrow to select MyApp (WebAssembly)

  • Press the MyApp (WebAssembly) button to deploy the app

  • To run/debug your WebAssembly app on a mobile device, you can utilize the Dev Tunnels feature of Visual Studio 2022/2026 (see Microsoft Learn documentation to get started)

ASP.NET Hosted WebAssembly

To run the ASP.NET Hosted WebAssembly (Server) head, if you've selected the option in the Wizard:

  • Right-click on the MyApp.Server project, select Set as startup project
  • Press the MyApp.Server button to deploy the app

Windows

To run the Windows (WinAppSDK) head:

  • In the debugger toolbar, click the down arrow to select MyApp (WinAppSDK Packaged) or MyApp (WinAppSDK Unpackaged)

  • Press the MyApp (WinAppSDK Packaged) or MyApp (WinAppSDK Unpackaged) button to deploy the app

  • If you have not enabled Developer Mode, the Settings app should open to the appropriate page. Turn on Developer Mode and accept the disclaimer.

[!NOTE] If you're not able or willing to turn on the Windows developer mode, read about this common issue.

iOS

To debug for iOS:

[!NOTE] For information about connecting Visual Studio to a Mac build host to build iOS apps, see Pairing to a Mac for .NET iOS development.

  • In the "Debug toolbar" drop-down, select framework net10.0-ios:

  • Select:

    • An active device, if your IDE is connected to a macOS Host

    • A local device using Hot Restart, to debug your application without connecting to a mac

      [!NOTE] If no iOS devices are available, a Visual Studio 17.7+ issue may require unloading/reloading the project. Right-click on the MyApp project and select Unload Project then Load project. [!IMPORTANT] When using a device connected to a Windows PC, the Release build configuration is not supported. An actual macOS machine is required.

Android

To debug the Android platform:

  • In the Debug toolbar drop-down, select framework net10.0-android

  • Select an active device in the "Device" sub-menu

    [!NOTE] If no android devices are available, a Visual Studio 17.7+ issue may require unloading/reloading the project. Right-click on the MyApp project and select Unload Project then Load project.


You're all set!

Next Steps

Now that you've created and debugged your app, you can continue development or you can use Copilot to accelerate your workflow.

Learn more about: