Pre Build Event: Copy Folder and it's SubFolders and files into Build Directory using XCopy

I have used this:

xcopy "$(ProjectDir)MyFolder\*.*" "$(SolutionDir)ConsoleApplication1\bin\Release\MyFolder" /Y /I /E

And worked fine, the folder 'MyFolder' appear into my 'Release' folder when I compile the project with all the documents in it.

Something to point out here is that the path that is after $(SolutionDir) would change depending of the name of your solution, my solution is ConsoleApplication1.


You need to add the /E switch to copy subdirectories (including Empty ones).


Better if it doesn't require a path with solution name or configuration type:

xcopy "$(ProjectDir)MyFolder\*.*" "$(TargetDir)\MyFolder" /Y /I /E