(Really) Clean Solution

When I clean my solutions I want it really clean, i.e. no obj folder and no bin folder in any of my projects.  I usually do this in preparation for zipping the solution or branching/labeling.  Unfortunately the VS2005 'Clean Solution' doesn't accomodate this.  I thought it would be fairly straight forward to do this in MSBuild but my initial attempts failed.  I finally came up with the build script below.  It achieves 98% of what I want (still doesn't remove the 'bin' dir, just empties it). 

Please test on throw away code first and use at your own risk.

<ItemGroup>
  <CleanFiles Include="**\bin\**\*.dll;**\obj\*FileList.txt" />
</ItemGroup>
 
<Target Name="Clean">
  <RemoveDir Directories="@(CleanFiles->'%(RelativeDir)')" ContinueOnError="true" />
</Target>

 

If you have a better/simpler/cleaner :) solution, please let me know.

posted @ Thursday, November 09, 2006 4:38 AM


Print

Comments on this entry:

No comments posted yet.

Your comment:



 (will not be displayed)


 
 
 
Please add 5 and 8 and type the answer here:
 

Live Comment Preview:

 
«August»
SunMonTueWedThuFriSat
272829303112
3456789
10111213141516
17181920212223
24252627282930
31123456