このページでは

Windows 向け Qt - Windows App SDK

設定

Qt アプリケーションでWindows App SDKを使用するには、SDK のパスを設定してください。

使用方法Qt Creator

Qt Creator で Windows App SDK を設定するには、[Preferences ] > [SDKs] の順に進みます。

\QC SDKの設定。

詳細については、『Qt Creator ドキュメント』を参照してください。

コマンドラインから

  1. 空のディレクトリに移動します。

    例:

    mkdir C:\Dev\wasdk
    cd C:\Dev\wasdk
  2. そのディレクトリにNuGet をダウンロードします。

    たとえば、PowerShell を使用してコマンドラインからダウンロードする場合は、次のようにします:

    powershell.exe -Command "& {Invoke-WebRequest https://dist.nuget.org/win-x86-commandline/latest/nuget.exe -OutFile nuget.exe}"
  3. NuGet を使用して Windows App SDK をダウンロードします。
    nuget.exe install Microsoft.WindowsAppSDK -OutputDirectory ./
  4. WIN_APP_SDK_ROOT 環境変数を、通常Microsoft.WindowsAppSDK.{Version} という名前のWindows App SDKディレクトリに設定します。

    たとえば、コマンドラインでは次のように指定します。

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

Qt アプリケーションでの Windows App SDK の使用

プロジェクトの CMake ファイル内で、qt_add_win_app_sdk(ProjectName) CMake 関数を呼び出します。ProjectNameには、ご自身のプロジェクト名を指定してください。

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.