0

When I 'Remove' a project from a Visual Studio solution I often want to delete it. As some other posts on SO have mentioned this does not delete the physical project from the file system.

The larger problem here is that after removing the project form the solution when I attempt to delete the directory from windows Explorer or the command line it will not delete because Visual Studio still has it locked.

Usually, I am able to resolve this by exiting Visual Studio then doing the delete. But, occasionally I have had to log off and back on before being able to delete the directory.

I have had this problem in VS2008, VS2010 and probably the earlier versions as well.

My question is, if there is no way to do this delete from inside Visual Studio, is there at least a way to get it to let go of the file(s) that it has locked?

JasonMArcher
  • 14,195
  • 22
  • 56
  • 52
Jim Reineri
  • 2,830
  • 3
  • 31
  • 32
  • Duplicate question: http://stackoverflow.com/questions/1530537/how-do-i-unlock-a-folder-programatically-in-net – Jim G. Jul 03 '10 at 14:49
  • You misunderstand, I do not want to unlock the file from code. I want Visual Studio to unlock the file. Visual Studio keeping the file locked after it has been removed from the open solution is extremely annoying behavior. The alledged 'duplicate' addresses a method of unlocking a file in code. – Jim Reineri Jul 03 '10 at 21:19
  • I thank each of you for you suggestions. I will try each one. Sadly, it appears that the holy grail of a solution to get Visual Studio to behave as it should have in the first place is not acheivable. – Jim Reineri Jul 03 '10 at 23:57

3 Answers3

3

You could use Process Explorer, which allows you to close specific handles a program is holding onto. Just open it up, find the Visual Studio process (devenv.exe), use View/Lower Pane View/Handles, locate the proper handle in the lower pane, right-click it and choose "Close Handle". May not be ideal, but sometimes this is better than closing your app or killing the process.

  • Thank you for the suggestion, I did not know that Process Explorer would do that. That is definately an improvement over having to log out of Windows. – Jim Reineri Jul 03 '10 at 22:03
1

Besides devenv.exe which goes away when you close Visual Studio, you might try killing mspdbsrv.exe. It will restart as soon as an instance of Visual Studio needs it.

DougN
  • 4,407
  • 11
  • 56
  • 81
1
  1. Open Task Manager ( Ctrl + Shift + Esc )
  2. Find "adb.exe" and click End Task
  3. Simply delete the folder.

Like in the image image1

Drilon Ahmetaj
  • 525
  • 5
  • 7