In questa pagina

Qt per Windows - Windows App SDK

Configurazione

Per utilizzare Windows App SDK nelle applicazioni Qt, configurare il percorso dell'SDK.

Utilizzo Qt Creator

Per configurare Windows App SDK in Qt Creator, andare su Preferences > SDKs.

\Preferenze degli SDK QC.

Per ulteriori informazioni, consultare la documentazione diQt Creator .

Dalla riga di comando

  1. Accedere a una directory vuota.

    Esempio:

    mkdir C:\Dev\wasdk
    cd C:\Dev\wasdk
  2. Scarica NuGet in quella directory.

    Ad esempio, per effettuare il download con PowerShell dalla riga di comando:

    powershell.exe -Command "& {Invoke-WebRequest https://dist.nuget.org/win-x86-commandline/latest/nuget.exe -OutFile nuget.exe}"
  3. Scarica Windows App SDK con NuGet.
    nuget.exe install Microsoft.WindowsAppSDK -OutputDirectory ./
  4. Impostare la variabile d'ambiente ` WIN_APP_SDK_ROOT ` sulla directory dell'SDK per app Windows, solitamente denominata ` Microsoft.WindowsAppSDK.{Version}`.

    Ad esempio, utilizzando la riga di comando:

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

Utilizzo di Windows App SDK nelle applicazioni Qt

Chiamare la funzione CMake qt_add_win_app_sdk(ProjectName) nel file CMake del progetto. Sostituire ProjectName con il nome del proprio progetto.

Utilizzare una condizione per garantire che la compilazione sia riservata esclusivamente alle build 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.