title: The command xcopy ... exited with code 9009 in Visual Studio
body: <p>When I build my solution with 10 Projects I get Build failures for 7 projects. All 10 Projects have post-build events. Even those who build use an xcopy command. I say this because my colleague was the opinion VS 2012 and xcopy is not that good...</p>
  
  <p>These 7 build failures did not happen before.</p>
  
  <p>The following error happens when I try to build the project or "from time to time" when I start my Visual Studio.</p>
  
  <p>I get this error:</p>
  
  <pre><code>Error   1   The command "xcopy /y "D:\Replaced\branches\ReplacedTest\Swan.Replaced.Mobile.Web\Client" "D:\Replaced\branches\ReplacedTest\build\web\bin\..\Client\" /s /e /v
  xcopy /y "D:\Replaced\branches\ReplacedTest\Swan.Replaced.Mobile.Web\Content" "D:\Replaced\branches\ReplacedTest\build\web\bin\..\Content\" /s /e /v
  xcopy /y "D:\Replaced\branches\ReplacedTest\Swan.Replaced.Mobile.Web\Views" "D:\Replaced\branches\ReplacedTest\build\web\bin\..\Views\" /s /e /v
  
  xcopy /y "D:\Replaced\branches\ReplacedTest\Swan.Replaced.Mobile.Web\web.config" "D:\Replaced\branches\ReplacedTest\build\web\bin\..\"
  xcopy /y "D:\Replaced\branches\ReplacedTest\Swan.Replaced.Mobile.Web\global.asax" "D:\Replaced\branches\ReplacedTest\build\web\bin\..\"
  
  xcopy /y "D:\Replaced\branches\ReplacedTest\Swan.Replaced.Mobile.Web\Tools" "D:\Replaced\branches\ReplacedTest\build\web\bin\..\..\Tools\" /s /e /v
  " exited with code 9009.    Swan.Replaced.Mobile.Web
  </code></pre>
  
  <p>I have googled a lot on SO and the main cause for this problem seem to be:</p>
  
  <pre><code>1.) A whitespace in the path/folder name
  2.) The command does not get full paths
  3.) Maybe some environment/system variables problem?
  </code></pre>
  
  <p>I can not see this error in my post-build event:</p>
  
  <pre><code>xcopy /y "$(ProjectDir)Client" "$(TargetDir)..\Client\" /s /e /v
  xcopy /y "$(ProjectDir)Content" "$(TargetDir)..\Content\" /s /e /v
  xcopy /y "$(ProjectDir)Views" "$(TargetDir)..\Views\" /s /e /v
  xcopy /y "$(ProjectDir)web.config" "$(TargetDir)..\"
  xcopy /y "$(ProjectDir)global.asax" "$(TargetDir)..\"
  xcopy /y "$(ProjectDir)Tools" "$(TargetDir)..\..\Tools\" /s /e /v
  </code></pre>
  
  <p>My TargetDir is this outputpath:</p>
  
  <pre><code>..\build\web\bin\
  </code></pre>
  
  <p>My ProjectDir is this:</p>
  
  <pre><code>D:\Replaced\branches\ReplacedTest
  </code></pre>
  
  <p>comment: When I use xcopy on the console window thats totally fine.</p>
  
  <p>These are my specs:</p>
  
  <ul>
  <li>Windows 7 (64bit)</li>
  <li>Visual Studio 2012 Premium</li>
  </ul>
  
  <p>What I have tried to fix the issue:</p>
  
  <ul>
  <li>Rebuild solution</li>
  <li>Clean solution</li>
  <li>wipe outputpath data</li>
  <li>reboot computer</li>
  <li>bite in the desktop</li>
  </ul>
  
  <p>Nothing helped :/</p>
  
  <p>Anyone can help please to spot the error? Thanks!</p>