Select Qt for Qt Bridge for C# projects
Building a Qt Bridge for C# project needs a Qt installation. The build finds it in the QtDir MSBuild property, which you can also set as an environment variable.
Only the Qt Bridge for C# package for Windows x64 brings its own Qt. On Windows ARM64, Linux, and macOS, you must set QtDir to a Qt 6 installation that matches the architecture of your computer. On Windows, it must be an MSVC build of Qt.
Select Qt in VS Code
If the build of a Qt Bridge for C# project would not find Qt, Qt Extension for Visual Studio Code asks you to select one when you open the project. Select Select Qt to do it right away.
To select Qt later, or to select a different Qt:
- Go to Command Palette, and select Qt Bridge C#: Select Qt Installation.
- Select one of the registered Qt installations. The list only shows installations that can build on your computer.
- To use a Qt installation that is not in the list, select Browse, and then select the installation prefix, the folder that contains the
binandlibfolders.
Qt Extension for Visual Studio Code stores the selection in the Qt Dir setting. It uses this Qt for the QML language server and QML Preview, and sets it as QtDir in new terminals in the Terminal view. Builds that you start there, such as dotnet build, use the same Qt.
Set QtDir for other builds
The Qt Dir setting does not reach builds that start outside the Terminal view, such as builds from C# Dev Kit or from Visual Studio. For them, set QtDir in one of the following ways:
- Set the
QtDirenvironment variable for your user account, and restart VS Code. For example, on Linux add the following line to your shell profile:export QtDir=~/Qt/6.11.0/gcc_64
On Windows, run the following command:
setx QtDir C:\Qt\6.11.0\msvc2022_64
- Set the
QtDirproperty in the project file or in aDirectory.Build.propsfile next to it:<PropertyGroup> <QtDir>C:\Qt\6.11.0\msvc2022_64</QtDir> </PropertyGroup>
This is useful if a project needs a particular Qt version, but the path is specific to your computer.
A QtDir property in the project overrides the environment variable and the Qt Dir setting.
Check which Qt the build uses
Newer versions of the Qt Bridge for C# packages show the Qt installation that the build uses in the build output, for example:
Qt Bridge for C#: Using Qt at 'C:\Qt\6.11.0\msvc2022_64'.
If the build does not find Qt, it stops with an error that asks you to set QtDir.
© 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.