visual-studiovisual-c++visual-studio-2015msbuildcustom-build-step

Cumulative Custom Build Steps in Visual Studio


Is it possible to have cumulative custom build steps in Visual Studio?

What I want to do is have a

if not exist "$(OutDir)" mkdir "$(OutDir)"

as a custom step for ALL configurations (current and possible future ones)

But for a specific configuration (say Deploy) I want to ADDITIONALLY do this

xcopy "$(ProjectDir)..\Resources" "$(OutDir)" /D /E /I /F /Y

Is this possible? I have tried adding a property sheet in Deploy with the xcopy command, but the All Configurations "custom build step" property (with the mkdir command) seems to completely overshadow the xcopy one!


Solution

  • It seems that you need to have a %(Command) added at the end of EVERY commands list to make the commands inheritable.

    Answer found here: https://stackoverflow.com/a/22749337/113718

    Having to add an extra "command" feels very hackish, if there is another, better solution, please share.