user943201213
user943201213

Reputation: 11

Visual Studio C++ Post Build Command not working

I am trying to copy my res folder from my project directory to my output directory but it's not working. I am not getting any errors by visual studio, it compiles and runs but doesn't copy. How do I copy the res folder from my project directory to my output directory so I don't have to manually copy it every time when I add new files to my project?

My post build command is:

xcopy /E "$(ProjectDir)res" "$(OutDir)"

Put in the post build events of the visual studio project

Upvotes: 0

Views: 329

Answers (1)

Barrnet Chou
Barrnet Chou

Reputation: 1933

You could refer to Microsoft Docs about xcopy.

/e Copies all subdirectories, even if they are empty. Use /e with the /s and /t command-line options.

For example:

I manually created the res folder in the ConsoleApplication1 folder. The res folder contains test.txt. I typed xcopy "$(ProjectDir)res" "$(OutDir)" /e. Then it works fine.

enter image description here

Upvotes: 1

Related Questions