'How to add QT support to a existing Visual Studio C++ CLI program?

Recently I am working on a Visual Studio C++ project that can copy files using win32 API. Now I try to add a Qt GUI to it. But all tutorials I found suggest that I should setup a new QT project or convert the VS project to CMake project.

I also spot a similiar question. According to the answer, I unload the project and add <Keyword>QtVS_v304</Keyword> (I got this from a newly created VS QT project). I got these errors as I tried to build the project:

error : There's no Qt version assigned to project FNP.vcxproj for configuration Debug/x64.
error : Please set a Qt installation in 'Project|Properties|Configuration Properties|Qt Project Settings|Qt Installation'.

I don't quite understand why modifying .vcxproj would work or how to make it work.

Is there a better way to add QT support to the existing VS C++ project?

Any suggestion would be appreciated!

p.s. To assist, Visual Studio Community 2022, QT 6.2.2, QT VS Tools ver 2.8.1(rev.6)



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source