Why does adding a custom build step to a Visual Studio Qt project with a Qt add-in stop the automatic MOC and UIC steps?

I have a Visual Studio Qt project using the Visual Studio Qt Add-in. The add-in automatically creates a Custom Build Tool rule for .ui files and for each header file that has classes with a Q_OBJECT declaration to run UIC and MOC, respectively.

All this works fine until I add the Custom Build Tool rule for the project as a whole. In this case, this rule applies to the Release assembly and causes the code to be signed and is set to Execute after: Build . In this configuration, the Debug assembly works correctly, but Release does not automatically start the MOC or UIC. I can right-click the Q_OBJECT and .ui file headers in the project browser and manually force compilation for all the necessary files, and they are correctly MOC'd and UIC'd, and then can be created, but recovery or assembly after cleaning does not always work .

Why is adding a project a Custom Build Rule for a project that seems to suppress the custom build rules of the tool associated with the .ui and Q_OBJECT headers?

+4
source share
1 answer

In the custom build step, set run after to BuildGenerateSources.

This is represented in the vcxproj file by adding a line

<CustomBuildAfterTargets Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">BuildGenerateSources</CustomBuildAfterTargets>

to block <PropertyGroup>

+2
source

All Articles