title: Determining what process has a lock on a file
body: <p>I have a unit test that works fine locally but when uploaded to TeamCity build server fails with "The process cannot access the file  because it is being used by another process."</p>
  
  <ol>
  <li>Before I do anything in the Test
  I check in the setup if the file
  exists and if so try to delete it.
  This fails with the same error
  message as above</li>
  <li>When wriitng the
  file, I close the writer then
  dispose of it which I believe should
  get rid of any resources.</li>
  </ol>
  
  <p>So I have a couple queries </p>
  
  <ol>
  <li>Has anyone had similar issues and manage to get around them</li>
  <li>How can find out programticall what
  process has selfishly locked the
  file!!!</li>
  </ol>
  
  <p>Cheers</p>