Sur cette page

Qt pour Windows - Windows App SDK

Configuration de l'application

Pour utiliser le Windows App SDK dans les applications Qt, configurez le chemin d'accès au SDK.

Utilisation Qt Creator

Pour configurer le Windows App SDK sur Qt Creator, allez sur Preferences > SDKs.

\QC SDKs Preferences.

Pour plus d'informations, voir Qt Creator Documentation.

À partir de la ligne de commande

  1. Allez dans un répertoire vide.

    Exemple :

    mkdir C:\Dev\wasdk
    cd C:\Dev\wasdk
  2. Téléchargez NuGet dans ce répertoire.

    Par exemple, pour télécharger avec PowerShell à partir de la ligne de commande :

    powershell.exe -Command "& {Invoke-WebRequest https://dist.nuget.org/win-x86-commandline/latest/nuget.exe -OutFile nuget.exe}"
  3. Télécharger le Windows App SDK avec NuGet.
    nuget.exe install Microsoft.WindowsAppSDK -OutputDirectory ./
  4. Définissez la variable d'environnement WIN_APP_SDK_ROOT sur le répertoire Windows APP SDK, généralement appelé Microsoft.WindowsAppSDK.{Version}.

    Par exemple, en utilisant la ligne de commande :

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

Utilisation du Windows App SDK dans les applications Qt

Appelez la fonction CMake qt_add_win_app_sdk(ProjectName) dans le fichier CMake du projet. Remplacez ProjectName par le nom de votre projet.

Utilisez une condition pour vous assurer que la compilation ne concerne que les compilations MSVC :

if (MSVC)
    qt_add_win_app_sdk(ProjectName)
endif()

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.