Saturday, November 28, 2015

Visual Studio - Clean leaves file residue

Visual Studio's clean project and clean solution don't do what I thought they did. I had never really paid much attention to these simple function, if the solution had problems trigger a clean, and magically stuff in the bin folder was cleaned up and issues fixed.  I was under the impression that these function simply triggered a delete one everything in bin.  How wrong I was!
All the referenced compiled files are removed, however other files and folders can still be hanging out in the build directories.  After some digging on the net I came across the following build target which can be added to the project file.

<Target Name="DeepClean"
        AfterTargets="Clean">
    <RemoveDir Directories="$(Outdir)"/>
</Target>
This will delete everything in the build directory, which more often than not is the desired action in my projects.

No comments:

Post a Comment