views:

696

answers:

6

Why does Visual studio take so long to delete a file from the solution tree? The app freezes and sits there for what feels like an eternity.

If I delete the file from the file system first, then delete it in the solution it happens instantly.

Is there an option I can set somewhere to avoid this?

+1  A: 

I've found that this is sometimes a symptom of project size. Deleting a file from a project with hundreds of files can take 30 seconds on my (admittedly slow) work computer. But deleting one of two files in a project is usually instant.

DannySmurf
A: 

Do you have a version control plugin with Visual Studio? It may be contacting a server to make sure you can check it out...

If not, where is the file located? Is it a local file or on the network? Sometimes if on the network, VS has to check if you have windows access to delete the file.

Miles
I think that's probably the case even for a local file. If the network connection is fast enough to host a VS project from, this probably shouldn't be much of a problem.
DannySmurf
A: 

Do you have Resharper installed? Once I installed it, it definitely slowed down file operations on my machine. Worth the tradeoff, I think.

Danimal
+1  A: 

it could be rebuilding/removing from the intellisense database or checking the rest of the project for validity once the file is deleted. Or it could just be that the new VSs are buggy.

gbjbaanb
The thing is though, if I've already deleted it on disk, it happens instantly, so it must have some links to the file system.
mattcole
It worked for me too.. I had 3k items in the bin (which is not that much IMO) and now it's instant. Weird!
A: 

It may be normal if your project size is very big. We are talking about a 50-200 projects solution.

If you have R# installed on your PC try to disable it or try to delete your project items with an empty recycle bin.

Altough I do not recommend it, you can try to delete all the *.opt and *.ncb files from all your project directories and bring Visual Studio up again.

Pascal Paradis
the post @ your last link has been updated - try deleting all your breakpoints.
Chloraphil
+9  A: 

I've found that when there is a lot in my Recycle Bin (1000s of files), it takes longer to delete a file in Windows Explorer as well as Visual Studio.

jrummell
http://mhinze.com/slow-file-delete-visual-studio/
Pondidum