当我在 Build 上遇到这样的错误时,如何找出哪个进程正在使用我的文件:
Error 18 Unable to copy file "Some.dll" to "bin\Debug\Some.dll". The process cannot access the file 'bin\Debug\Some.dll' because it is being used by another process.
最佳答案
这绝对是我以前不得不使用的一个技巧。
我已将所有 SysInternals 实用程序添加到我的 PATH 变量中。
具体可以使用handle
available here找到打开文件的内容,然后使用 PsKill
available here消灭罪魁祸首!
编辑
这是一个示例输出
C:\Users\jschubert>handle wowza.txt
Handle v3.46
Copyright (C) 1997-2011 Mark Russinovich
Sysinternals - www.sysinternals.com
Acrobat.exe pid: 6800 type: File 284: C:\Users\jschubert\Desktop\something!\wowza.txt
C:\Users\jschubert>pskill Acrobat.exe
PsKill v1.13 - Terminates processes on local or remote systems
Copyright (C) 1999-2009 Mark Russinovich
Sysinternals - www.sysinternals.com
Process Acrobat.exe killed.
关于.net - 如何找出正在使用我的文件的进程?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7484604/