Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I find out what process is using my file?

How can I find out which process is using my file when I get such an error on the 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.

like image 526
pencilCake Avatar asked Sep 20 '11 11:09

pencilCake


2 Answers

This is definitely a trick I've had to use before.

I have all of SysInternals utilities in a folder that I've added to my PATH variable.

Specifically, you can use handle available here to find what has the file open, then use PsKill available here to nix the culprit!

EDIT

here's an example output

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.
like image 96
Jim Schubert Avatar answered Sep 22 '22 10:09

Jim Schubert


Close your application form the visual studio,

If you visual studio is not running, go to task manager and then close your program

(Sometimes your application is running not attached to visual studio )

like image 42
Ronaldinio Avatar answered Sep 21 '22 10:09

Ronaldinio