title: Command copy exited with code 4 when building - Visual Studio restart solves it
body: <p>Every now and then when I build my solution here (with 7 projects in it) I get the dreaded 'Command copy exited with code 4' error, in Visual Studio 2010 Premium ed.</p>
  
  <p>This is because of the post-build event not being able to go through.</p>
  
  <p>Here's what solves the problem, temporarily</p>
  
  <ul>
  <li>Sometimes: A restart of Visual Studio and I'm able to build the solution</li>
  <li>Sometimes:  Both a restart of Visual Studio and my file manager of choice (Q-Dir 4.37) solves it.</li>
  </ul>
  
  <p>Here's what the post-build event looks like:</p>
  
  <pre><code>xcopy "$(SolutionDir)Solution Items\References\*.dll" "$(TargetDir)" /Y
  </code></pre>
  
  <p>When you get the command copy exited with code [insert value] error, it's normally because of the following:</p>
  
  <ul>
  <li>read / write permissions</li>
  <li>missing files</li>
  <li>wrong directories</li>
  </ul>
  
  <p>However - obviously at times when I build the solution, there's no problem.</p>
  
  <p>FYI, I uninstalled ReSharper 5.1.1 two weeks ago and Visual Studio's been giving me some errors since then (among them not being able to debug). I re-installed Visual Studio and it's working better since then, but still get this problem. Could it have to do with some ReSharper stuff being somewhere?</p>
  
  <p>Have you had the same problem and solved it? Or do you have any possible solution to it?</p>