title: Visual Studio locks output file on build
body: <p>I have a simple WinForms solution in VS 2010. Whenever I build it, output file (bin\debug\app.exe) ends up locked, and subsequent builds fail with a message like 
  <code>"The process cannot access the file 'bin\Debug\app.exe' because it is being used by another process."</code>
  The only way to build the project is to restart VS after every build, which is <em>very</em> awkward.</p>
  
  <p>I have found this old blog post <a href="http://blogs.geekdojo.net/brian/archive/2006/02/17/VS2005FileLocking.aspx" rel="noreferrer">http://blogs.geekdojo.net/brian/archive/2006/02/17/VS2005FileLocking.aspx</a> - it seems that the problem is really old. Does anyone know what is happening here, or at least some workaround?</p>
  
  <p><strong>Update</strong></p>
  
  <p>I don't actually <em>run</em> the file. Locking happens after build, not after debug (i.e. start VS - build - build - fail!)
  And I tried turning antivirus off. It doesn't help.</p>
  
  <p><strong>Update 2</strong></p>
  
  <p>Process Explorer shows devenv.exe having loaded the file (in DLLs, not in Handles). It seems like some glitch during build prevented the unloading, but the (first) build completes without any messages other then "1 succeeded, o failed"/</p>