Project Description
Command line tool that finds Visual Studio solutions and runs the Clean command on them. This lets you clean up the /bin/* directories of all those old projects you have lying around on your harddrive

Check out what I'm up to at my Blog: http://codecube.net

I don’t know about you, but I have a lot of code on my computer. I’m often running out of space on my laptop. So yesterday, I was running WinDirStat on my harddrive to see what I could clean up. I found that I had a significant amount of space spent on the contents of my /bin/* folders. As any developer would know, this is where Visual Studio places binary files when it compiles. So any time I have a visual studio solution from some old project, inevitably, I’ll have tons and tons dlls and exes just sitting around, not to mention content that may be part of the solution such as .mdb files, and in the more extreme cases, XNA game content.

So I started opening the folders and deleting them when I lamented that I wished I could just tell visual studio to run a Clean Solution command on all these files. Then it hit me, visual studio uses MSBuild to do it’s compiling. So why not write a simple tool that recurses through my dev directory and runs the msbuild clean command on all the solutions it finds. Brilliant!

You can either compile the executable from source, or download the release. Run it from the command line and pass in your root source code directory as the first parameter:
   VSClean.exe “c:\dev”

Once you run this, it’ll iterate through all the folders in that directory looking for .sln files. Once it finds them, it runs this command:
  C:\Windows\Microsoft.NET\Framework\v3.5\MSBuild.exe “c:\dev\theSolution.sln” /m /t:clean


It will also delete any "TestResults" folder encountered. These folders are used by MSTest to store the results of test runs.

please note: If you’ve installed the framework in a different path, you’ll have to change the const variable at the top of the class. Once this is done, you can feel good that all of your old source code isn’t taking up unnecessary space.

Once you download the VSClean.exe file, you can add path to the PATH environment variable so that you can just run it directly from the start > run dialog.

Last edited Dec 24, 2009 at 2:22 AM by joelmartinez, version 7