Share via


Clean Build for Visual Studio Solutions

Every time you need to zip a solution, you need to clean up all the folders that will be generated in the next build. If you think that the Build->Clean Menu options does what you think, your are wrong, it only cleans the bin folders, not the obj.

To really clean your folders you can use this msbuild script, it also will remove your TestResults Files and DBModels.

    1: <?xml version="1.0" encoding="utf-8"?>
    2: <Project xmlns="https://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="CleanAll"> 
    3:     <Target Name="CleanAll"> 
    4:         <CreateItem Include=".\**\debug\**\*;.\**\release\**\*;.\**\sql\**\*;.\TestResults\**\*;.\**\*.*scc;.\**\*.user">
    5:             <Output ItemName="DbgFiles" TaskParameter="Include"/>
    6:         </CreateItem>
    7:  
    8:         <Message Text="Deleting Debug Files" Importance="high" />
    9:         <Delete Files="%(DbgFiles.Identity)" ContinueOnError="true" TreatErrorsAsWarnings="true">
   10:             <Output ItemName="DeletedFiles1" TaskParameter="DeletedFiles"/>
   11:         </Delete>
   12:         <Message Text="%(DeletedFiles1.Identity)" /> 
   13:     </Target>
   14: </Project>