Home » Blog
date 23.Dec.2018

■ Disk cleanup revisited: delete intermediate Visual Studio project files


Solid state SSD hard disks are smaller (price per MB is much higher than regular hard disks) and easier to fill up. The other day we saw how to free up space removing generic temporary and duplicate files, that accumulate during everyday computer use. Deleting junk has no ill effects and makes space to store something more useful instead.

If you are a programmer and use MS Visual Studio (especially the latest versions thereof), there is more opportunity for clean-up. Take for example the pic to the right, representing the disk usage of a single VS2010 project for DeskRule. The source code is 4MB and the executable end result is under 2MB but the total space used is 1GB (!) — a thousand times bigger!

xplorer² Tools > Folder statistics menu command has identified the subfolders that take up most space. If we want to get more details we can issue a search command for file sizes >10MB, and this is what we get:

deskrule.sdf	247,287,808	SQL Server Database
deskrule.ilk	12,945,388	Incremental Linker File
deskrule.pdb	31,641,600	Program Debug Database
deskrule.pch	67,174,400	Precompiled Header File
deskrule-3dd8aecb.ipch	124,387,328	more precompiled
-------
TOTAL BYTES	483,436,524

See how 5 files out of the 400 that comprise the project, occupy half the used space. They are intermediate files associated with intellisense, precompiled headers and so on. Now multiply this with a few 100s of old visual studio projects and you can see how that expensive SSD drive will fill up quickly!

Sometimes I keep PDB files despite their lard, for post-mortem debugging



There's not much point deleting visual studio intermediate files if you actively work with a project. They will just be rebuilt next time you compile. However, if you have old projects that you haven't worked on for a while (and it is unlikely you'll ever work with them again), then deleting the temporary files makes sense and can free up a lot of disk space.
vs2010 project disk space

With xplorer² it is easy to selectively delete the huge files without touching the smaller or important ones. One possibility is to find file sizes >=10MB and delete the search results. Or you can use the robust deletion function, which accepts a file filter, to target only the known large files for deletion. You can include multiple file types as a comma separated wildcard list, as such:

*.sdf,*.ilk,*.pdb,*.ipch,*.pch

Select the root solution folder, press <SHIFT+DEL> keys, and use the above list of file extensions in the robust deletion dialog, and only these files will be deleted.

robust deletion dialog with file filter
Figure 1. Robust deletion through wildcard filter
WARNING: This method of deletion is permanent and cannot be undone, so please be careful what you select! For more safety you can use the previous method of first finding then deleting the huge files. The process can be automated using a batch script or a xplorer² macro.

For a more thorough cleanup you can also remove object (*.obj) files and lots of other visual studio junk. At the extreme you only need to keep the source code files, and all the rest can be re-created building the solution!

Best season's greetings everyone!

Post a comment on this topic »

Share |

©2002-2018 ZABKAT LTD, all rights reserved | Privacy policy | Sitemap