.net - 如何找出正在使用我的文件的进程?

标签 .net visual-studio build

当我在 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/

相关文章:

.net - 响应式图像 : Resize or Dynamically Crop?

c++ - 类的构造函数的声明和定义并打印私有(private)和公共(public)变量?

testing - 由于 AppDomain.CurrentDomain,TFS 构建机器中的单元测试失败

javascript - 如何让html页面检测回车键被按下?

c# - 如何获取所选幻灯片的ID

c# - 从内存中播放 wav/mp3

wpf - VS Wpf Designer如何实例化和限制执行VIewModel代码?

c++ - 如何制作包含所有数据文件的mfc项目的独立安装文件

c++ - 让 C++ 程序在不使用系统的情况下构建 Visual C++ 项目?

android-studio - Android Studio 不会从 Studio ide 运行应用程序?