- Qt 6.10
- Qt for Windows - Windows App SDK
- Qt 6.10.3 Reference Documentation

# Qt for Windows - Windows App SDK

## Configuration

To use Windows App SDK in Qt apps, configure the SDK path.

### Using Qt Creator

To configure the Windows App SDK in Qt Creator, go to Preferences > SDKs.

For more information, see Qt Creator Documentation.

### From the command line

1. Go to an empty directory.

   Example:

        mkdir C:\Dev\wasdk
        cd C:\Dev\wasdk

2. Download NuGet into that directory.

   For example, to download with PowerShell from the command line:

        powershell.exe -Command "& {Invoke-WebRequest https://dist.nuget.org/win-x86-commandline/latest/nuget.exe -OutFile nuget.exe}"

3. Download the Windows App SDK with NuGet.

        nuget.exe install Microsoft.WindowsAppSDK -OutputDirectory ./

4. Set the `WIN_APP_SDK_ROOT` environment variable to the Windows APP SDK directory, usually called `Microsoft.WindowsAppSDK.{Version}`.

   For example, using the command-line:

        cd Microsoft.WindowsAppSDK.*
        set WIN_APP_SDK_ROOT=%cd%
        setX WIN_APP_SDK_ROOT %cd%

## Using the Windows App SDK in Qt apps

Call qt_add_win_app_sdk(ProjectName) CMake function in the project's CMake file. Replace ProjectName with your project name.

Use a condition to ensure the build is only for MSVC builds:

     if (MSVC)
         qt_add_win_app_sdk(ProjectName)
     endif()