Edit

Share via


Setup and tooling for WinUI

Welcome to Windows app development. This guide will take you through the steps needed to begin creating your first app with WinUI. It will also point you to resources that will help you learn more about Windows development. If you want a step-by-step guide to setting up your developer environment and building your first WinUI app with the latest tools, please see WinUI 101.

1. Enable Developer Mode

Windows has a special mode for developers that adjusts security settings so you can run the apps you're working on. You need to enable Developer Mode before you can build, deploy, and test your app by using Visual Studio.

Tip

If you don't enable Developer Mode now, Visual Studio prompts you to enable it when you try to build your app.

To enable Developer Mode:

  • Open Windows Settings and navigate to the System > Advanced page.
  • Toggle the Developer Mode switch to On and confirm your choice in the confirmation dialog.

For more information about Developer Mode, see Settings for developers.

2. Install Visual Studio and required workloads

Use Visual Studio, Microsoft’s powerful IDE, to build, debug, and deploy your WinUI app. It offers ready-to-use project templates for Windows and other platforms to help you get started quickly.

The free Visual Studio Community Edition includes everything you need to develop apps. Larger teams or enterprises may require Professional or Enterprise editions. Learn more in What is Visual Studio? and system requirements for Windows app development.

Install the required tools and workloads by running one of the following commands in the console.
The command opens the Visual Studio Installer with any missing workloads preselected — just choose Modify to install them.

If you prefer, you can replace Community with Professional or Enterprise to install those editions instead.

For C# app development

winget install "Visual Studio Community 2022"  --override "--add Microsoft.VisualStudio.Workload.ManagedDesktop Microsoft.VisualStudio.ComponentGroup.WindowsAppSDK.Cs" -s msstore

For C++ app development

winget install "Visual Studio Community 2022"  --override "--add Microsoft.VisualStudio.Workload.NativeDesktop  Microsoft.VisualStudio.ComponentGroup.WindowsAppSDK.Cpp"  -s msstore

3. Create and launch your first WinUI app

Visual Studio project templates include all the files you need to quickly create your app. In fact, after you create your project from a WinUI app template, you already have an app that you can run, and then add your code to.

To create a new project by using the WinUI C# Blank App project template:

  1. Open Visual Studio and select Create a new project from the launch page. (If Visual Studio is already open to the editor, select File > New > Project): Create a new project

  2. Search for WinUI and select the WinUI Blank App (Packaged) C# project template, then select Next: Blank, packaged WinUI 3 C# desktop app

  3. Specify a project name, then select Create. You can optionally specify a solution name and directory, or leave the defaults. In this image, the Hello World project belongs to a Hello World solution, which lives in C:\Projects\: Specify project details

    Note

    If you want to use this project to build the complete app in the Next steps section, name the project WinUINotes.

  4. Select the Debug "Start" button to build and run your project:
    Build and run your project
    Your project will build, be deployed to your local machine, and run in debug mode:
    Hello World project built and running

  5. To stop debugging, close the app window, or select the debug "Stop" button in Visual Studio.

Congratulations, you've just built your first WinUI app! Continue with the next steps below to explore more.

Next steps

  • To get an idea of what WinUI offers, check out the WinUI Gallery app.

    The WinUI 3 Gallery app includes interactive examples of most WinUI 3 controls, features, and functionality. Get the app from the Microsoft Store or get the source code on GitHub

  • Learn more about WinUI fundamentals.
  • Explore Fluent Design principles.
  • Find samples and tools to help you develop apps more efficiently.