How to set up an C# Markup project for Toolkit
In this tutorial, you'll learn how to set up an Uno Platform project to use C# Markup.
Make sure your environment is set up properly by using uno check.
You can create a Uno App by either using the Uno Platform Visual Studio extension or via the command line interface.
Using Visual Studio 2022 Uno Platform Extension
Open the Visual Studio and select Extensions => Manage Extensions and Search (Ctrl + E) for unoplatform.
Make sure you have the latest version of Uno Extension (v5.0 or higher) installed.
Press Ctrl+Shift+N to create a new project and select "Uno Platform App".
Give your project an appropriate name (
MySampleToolkitProject
in this page).When prompted Select Blank and click Customize
In the Markup tab (4rd one), select C# Markup.
In the Features tab (7rd one), select Toolkit.
Click Create on the bottom right corner.
Toolkit References
Looking in detail at the projects with the addition of the Toolkit, we can see the addition of some additional references. This allows an easy inclusion of the Toolkit in existing projects.
Add the references to the Directory.Packages.props file (with the updated version).
<PackageVersion Include="Uno.Toolkit.WinUI" Version="0.0.0" /> <PackageVersion Include="Uno.Toolkit.WinUI.Markup" Version="0.0.0" />
Add the package to the following projects:
- PROJECT_NAME.Wasm.csproj
- PROJECT_NAME.Mobile.csproj (or PROJECT_NAME.iOS.csproj, PROJECT_NAME.Droid.csproj, PROJECT_NAME.macOS.csproj if you have an existing project)
- PROJECT_NAME.Skia.Gtk.csproj
- PROJECT_NAME.Windows.csproj (or PROJECT_NAME.UWP.csproj for existing projects)
<PackageReference Include="Uno.Toolkit.WinUI.Markup" />
Choose either:
- The Uno.Toolkit.UI package when targeting Xamarin/UWP
- The Uno.Toolkit.WinUI package when targeting net6.0+/WinUI