Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I find out which process is locking a file using .NET?
    text
    copied!<p>I've seen several of answers about using <a href="http://technet.microsoft.com/en-us/sysinternals/bb896655.aspx" rel="noreferrer">Handle</a> or <a href="http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx" rel="noreferrer">Process Monitor</a>, but I would like to be able to find out in my own code (C#) which process is locking a file. </p> <p>I have a nasty feeling that I'm going to have to spelunk around in the win32 API, but if anyone has already done this and can put me on the right track, I'd really appreciate the help. </p> <h2>Update</h2> <h3>Links to similar questions</h3> <ul> <li><a href="https://stackoverflow.com/questions/860656/how-does-one-figure-out-what-process-locked-a-file-using-c">How does one figure out what process locked a file using c#?</a></li> <li><a href="https://stackoverflow.com/questions/241178/command-line-tool-for-finding-out-who-is-locking-a-file">Command line tool</a></li> <li><a href="https://stackoverflow.com/questions/208283/is-it-possible-to-programatically-find-out-what-process-is-locking-a-file-acros">Across a Network</a></li> <li><a href="https://stackoverflow.com/questions/23197/find-out-which-process-has-an-exclusive-lock-on-a-usb-device-handle">Locking a USB device</a></li> <li><a href="https://stackoverflow.com/questions/305843/determining-what-process-has-a-lock-on-a-file">Unit test fails with locked file</a></li> <li><a href="https://stackoverflow.com/questions/1040/how-do-i-delete-a-file-which-is-locked-by-another-process-in-c">deleting locked file</a></li> </ul>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload