Background
Most non-trivial applications have a lot of files of source code. Unless the application uses an interpreted language, those files are compiled into other types like executables and DLLs. Add in multiple configurations, and you will soon have many megabytes of files on your disks.
C# and web applications, in particular, usually have many files, binaries and DLLs in Obj and Bin folders. VS Solutions can also have many projects within them; some projects have hundreds, and others may have thousands of projects. Each project has an Obj and Bin folder of its own. Each project is compiled into those folders. If you have Release and Debug build configurations, each project will have two sets of Obj and Bin folders.
Over time, solution folders will grow to consume vast amounts of disk space.
Our flagship product at work has over 40GB of files. Over time, as you try different build configurations, the amount of space increases, too.
Recovering space
So, how do you recover space back?
You can clean a solution, but that doesn’t clear everything. It leaves a lot of unnecessary files, so that doesn’t work – I find it ridiculous after so many years that VS still doesn’t clear up properly.
Fortunately, there is a solution in the form of a little bit of Powershell: –
Get-ChildItem c:\TFS -include bin,obj -Recurse | foreach ($_) { remove-item $_.fullname -Force -Recurse -WhatIf }
This recursively deletes all bin and obj folders from the start point (‘c:\TFS’ in this example).