Muokkaa

Jaa


Start developing Windows apps

Welcome to Windows app development. This guide will take you through the steps needed to begin creating apps using the latest Windows development frameworks: the Windows App SDK and WinUI. It will also point you to resources that will help you learn more about Windows development. If you are already comfortable developing apps for Windows, but want to know more about the latest tools, please see Develop Windows desktop apps.

Tip

Microsoft Copilot is a great resource if you have questions about getting started writing Windows apps.

1. Install Visual Studio

You'll use Visual Studio, Microsoft's comprehensive integrated development environment (IDE), to create your WinUI app. It's the preferred development tool of many Windows developers and it will help you write, debug, and deploy your apps. The project templates in Visual Studio will quickly get you started with projects for Windows and many other platforms.

Tip

Before installing these tools, make sure your development computer meets the system requirements for Windows app development.

Use this link to download and install the latest Visual Studio. The installer will walk you through the steps, but if you find you need detailed instructions, see Install Visual Studio.

The free Visual Studio Community Edition includes everything you need to create your apps. If you're working with a development team or enterprise, you might need Visual Studio Professional or Visual Studio Enterprise. See What is Visual Studio? for more info.

Required workloads and components

While installing Visual Studio, you need to install the workloads and components required for developing with WinUI and the Windows App SDK. After installation, you can open the Visual Studio Installer app and select Modify to add workloads and components.

On the Workloads tab of the Visual Studio Installer app, select the following workloads and components:

  • For C# app development using the Windows App SDK, select Windows application development.

A screenshot of the Visual Studio installer UI with the Windows application development workload selected.

  • For C++ app development using the Windows App SDK, select Windows application development.
    • Then in the Installation details pane, under the Windows application development node, select C++ WinUI app development tools. (This will also select any additional required components.)

A screenshot of the Visual Studio installer UI with the C++ WinUI app development tools selected.

2. Enable Developer Mode

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

Tip

If you don't enable it now, you'll be prompted to enable it when you try to build your app in Visual Studio.

To enable Developer Mode:

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

For more information about Developer Mode, see Enable your device for development.

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'll already have an app that you can run, and then add your code to.

To create a new project 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 Blank App, Packaged (WinUI 3 in Desktop) C# project template, then click Next: Blank, packaged WinUI 3 C# desktop app

  3. Specify a project name, then click 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 will live in C:\Projects\: Specify project details

  4. Click the Debug "Start" button to build and run your project:
    Build and run your project
    Your Hello World 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 click the debug "Stop" button in Visual Studio.

4. Update to the latest WinUI/Windows App SDK

The Windows App SDK (and WinUI, which is part of it) is distributed as a NuGet package. This means updates can be released out-of-sync with Windows and Visual Studio. As a result, the Visual Studio template you used to create your project might not reference the latest Windows App SDK NuGet package. To ensure you have the latest features and fixes, you should update your NuGet packages every time you create a new project in Visual Studio.

To update the Windows App SDK NuGet package for your project:

  • In Visual Studio, with your project loaded, select Tools > NuGet Package Manager > Manage NuGet Packages for Solution....
  • If an update is available, it will appear on the Updates page. Check the box next to the listed update. (To include prerelease updates, check the "Include prerelease" option. To learn more about what's included in an update, see the release notes.)
  • Click the Update button, then click Apply in the Preview changes dialog, then accept the license terms to finish installing the update.

A screenshot of the NuGet package manager in Visual Studio showing a Windows App SDK package update.

Now your project is using the latest WinUI features that are available, and it's ready for you to make it your own.

Next steps