VisualStudion 2012: Post build Events

67 views Asked by At

In my project I have got following post-build Event:

xcopy "$(TargetDir)Data" "$(ProjectDir)Data" /Y /I

After the run has ended the program copies the files. But if in TargetDir/Data is a complete NEW file, this event does not copy the new file to ProjectDir/Data.

but I would like to have this new files copied to TargetDir/Data. How do I achieve this?

Thanks for help!

1

There are 1 answers

1
Hans Passant On BEST ANSWER

"Data" sounds like a directory, not a file. You'll have to create it first. You also appear to have reversed the arguments. Fix:

  if not exist "$(TargetDir)Data" mkdir "$(TargetDir)Data".
  xcopy "$(ProjectDir)Data\*.*" "$(TargetDir)Data" /Y /I /D

If you in fact meant to copy back to the project directory, very unusual, then just swap TargetDir and ProjectDir in the above snippet.