Get Started on Visual Studio 2022
This section is covering releases of .NET 6 and Visual Studio 2022. It is a work in progress.
Prerequisites
Visual Studio 2022 17.0 or later, with:
- Universal Windows Platform workload installed.
- Mobile development with .NET (Xamarin) workload installed.
Starting from Visual Studio 2022 17.2 Preview 2, select the .NET Maui (Preview) optional component (Installs the .NET 6 Android and iOS workloads)
- The iOS Remote Simulator installed (for iOS development)
- A working Mac with Visual Studio for Mac, Xcode 13.3 or later installed (for iOS development)
- Google's Android x86 emulators or a physical Android device (for Android development)
ASP.NET and web workload installed, along with .NET 6.0 (for WebAssembly development)
For more information about these prerequisites, see Installing Xamarin. For information about connecting Visual Studio to a Mac build host, see Pair to Mac for Xamarin.iOS development.
Finalize your environment setup using uno-check
- Install the uno-check tool:
dotnet tool install -g Uno.Check
- Run the uno-check tool:
uno-check
Follow the steps indicated by the tool.
Installing the Uno Platform Solution Templates with Visual Studio
Launch Visual Studio 2022, then click
Continue without code
. ClickExtensions
->Manage Extensions
from the Menu Bar.In the Extension Manager expand the Online node and search for
Uno
, install theUno Platform Solution Templates
extension or download it from the Visual Studio Marketplace, then restart Visual Studio.
Create an application from the Xamarin solution template
To easily create a multi-platform application:
- Create a new C# solution using the Multi-Platform App (Uno Platform|Xamarin) template, from Visual Studio's Start Page:
- Right click on the Solution and select
Manage NuGet Packages for Solution
from the context menu. - Update the follow NuGet packages to the latest:
Uno.UI
Uno.UI.WebAssembly
Uno.UI.Skia.Gtk
,Uno.UI.Skia.Wpf
,Uno.UI.Skia.Tizen
,Uno.UI.Skia.Linux.FrameBuffer
- To debug the iOS head, select the
Debug|iPhoneSimulator
configuration - To debug the Android head, select the
Debug|Any CPU
configuration - To debug the UWP head, select the
Debug|x86
configuration - To run the WebAssembly (Wasm) head, select IIS Express and press Ctr+F5 or choose
Start without debugging
from the Debug menu. To enable full debugging, see these debugging instructions.
Create an application from the .NET 6 Mobile Preview solution template
.NET 6 Mobile support is currently in Preview, following Microsoft's support status. As of Uno 4.1, .NET 6 Mobile Preview 14 and above is supported with Visual Studio 2022 17.2 Preview 2. Previous releases of Visual Studio are not supported.
Prerequisite
Run the uno-check tool using the preview channel:
uno-check --pre
To create a multi-platform application:
- Create a new C# solution using the Multi-Platform App (Uno Platform|net6) template, from Visual Studio's Start Page
- Right click on the Solution and select
Manage NuGet Packages for Solution
from the context menu. - Update to the latest NuGet package named
Uno.UI
. - To debug the iOS:
- In the "Debug toolbar" drop down, select framework
net6.0-ios
- Select an active device
- In the "Debug toolbar" drop down, select framework
- To debug the Android platform:
- In the "Debug toolbar" drop down, select framework
net6.0-android
- Select an active device in "Device" sub-menu
- In the "Debug toolbar" drop down, select framework
- To debug the UWP head:
- Select the
Debug|x86
configuration - Debug the project
- Select the
- To run the WebAssembly (Wasm) head:
- Select IIS Express and press Ctrl+F5 or choose 'Start without debugging' from the menu.
Debugging either the macOS and macCatalyst targets is not supported from Visual Studio on Windows.
Make sure XAML Intellisense is enabled
Intellisense is supported in XAML when the UWP head is active:
If XAML Intellisense isn't working on a freshly-created project, try the following steps:
- Build the UWP head.
- Close all XAML documents.
- Close and reopen Visual Studio.
- Reopen XAML documents.
Troubleshooting Visual Studio and Uno Platform Installation Issues
You may encounter installation and/or post-installation Visual Studio issues for which workarounds exist. Please see Common Issues we have documented.
If you're not sure whether your environment is correctly configured for Uno Platform development, running the uno-check
command-line tool should be your first step.
Getting Help
If you continue experiencing 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.