Determining what process has a lock on a file
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." 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 When wriitng the file, I close the writer then dispose of it which I believe should get rid of any resources. So I have a couple queries Has anyone had similar issues and manage to get around them How can find out programticall what process has selfishly locked the file!!