This has been detailed in Chris Houston’s blog post. However, when I tried doing it on a Windows 7 system, I got the following error message:
Error 3 The command “@echo off
echo *** COPY ***
robocopy “Source” “Destination” /MIR /NP /XD” exited with code 16.
In order to debug what was going on, I used the Robocopy UI and ran one robocopy command only to check if copying was successful. It turns out that I had the “Source” path wrong.
However, even after I got the path right I got the message with exit code 1. For the life of me I couldn’t work out what was going wrong as the copying process seemed to have executed successfully.
That’s when I stumbled upon http://japikse.blogspot.com/2009/03/using-robocopy-in-visual-studio-build.html and after reading that post it made sense.