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?
The reason is that during the delete process, Windows 10 runs calculations, analyzes, and shows updates as files and folders get deleted on the screen, something that usually takes time when deleting a large folder with thousands of files and subfolders.
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. 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.
Yes, you can delete it. visual studio will simply recreate that folder for you. Save this answer. Show activity on this post.
To delete a file in C#, you can use System. IO. File. Delete(path) function.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With