I have a Visual Studio solution with a project that generate a cpp and a hpp file.
An other project have to compile these generated files, so I add the cpp file as a “Custom Build” target and the hpp file is “Excluded From Build” (I put it in the solution just to be able to view it).
The program who generate the files works fine and can only exit with 0 as return value, but I have the following error when the second project :
C:Program FilesMicrosoft Visual Studio2022CommunityMSBuildMicrosoftVCv170Microsoft.CppCommon.targets(254,5): error MSB8066: Custom build for '..sourcesASMgeneratedASM_x64.cpp' exited with code -1.
I also have this warning some times:
C:Program FilesMicrosoft Visual Studio2022CommunityMSBuildMicrosoftVCv170Microsoft.CppCommon.targets(254,5): warning MSB8017: A circular dependency has been detected while executing custom build commands for item "..sourcesASMgeneratedASM_x64.cpp". This may cause incremental build to work incorrectly.
The generator project it correctly build before everything else and the files are correctly generated.
Here are the “Custom Build” settings of the cpp file:
What I am missing?