Normally, the new QtMsBuild system puts a bunch of build output subdirectories into the Visual Studio Intermediate Directory, $(IntDir), such as "moc", "rcc", and "qmake".
When comparing Visual Studio 2022 to Visual Studio 2019 the "qmake" folder is no longer in the correct location and this is causing a problem when having 2 projects in the same folder. Normally, the default Intermediate Directory in a Visual Studio project is $(Platform)/$(Configuration). So something like "x64/Debug". But when you have 2 projects in the same folder, that will cause problems with intermediate files from each project "colliding" with each other (e.g. one project's build keeps trying to overwrite the other project's files and vice versa). The solution to this is to change the Intermediate Director to $(Platform)/$(Configuration)/$(Project). So now the intermediate directory is something like "x64/Debug/ProjectA" and "x64/Debug/ProjectB" and each project can truly be built independently from the other one. This has been working fine for building Qt projects from VS2008 to VS2019. The "qmake" folder shows up in the following locations in this setup:
Also, the "rcc" and "moc" folders would also show up properly in those locations. However, with Visual Studio 2022, the "qmake" folder is no longer being placed in the proper location. Regardless of what the Visual Studio Intermediate Directory is configured to be, the "qmake" folder is also placed in "$(Platform)/$(Configuration)". But the "moc" and "rcc" files are placed in the proper location.
Because of the incorrect placement of the "qmake" folder, both ProjectA and ProjectB are attempting to access files simultaneously and that causes build errors.
This is most likely related to MSBuild's property evaluation. For the reference, please see the following:
As a workaround:
VS Property Manager can be used to define customized property values in a project like instructed at:
But because this is working for "rcc" and "moc", this should not be needed and the user experience should be as good as with the previous versions of VS.
To make the QtMsBuild system have its own "Intermediate Directory" that doesn't depend on Visual Studios or, alternatively, reorganize the parts of the "qmake" folder that should be project-specific to work like the "rcc" and "moc" directories, maybe by reorganizing the information in "Qt.props" so that its relevant parts can still be loaded before $(IntDir) is defined, but not the part that specifies where the "qmake" folder should be located.