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!
To that end, I’d like to introduce the command line tool VSClean. Download here: http://codecube.net/bloguploads/VSClean.zip
Update: This project has been moved to CodePlex: http://vsclean.codeplex.com/
The zip file above is the source code. Once you compile it, just run it from the command line and pass in your root source code directory as the first parameter:
> VSClean “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:cleanOf course, 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 :-)