MSBuild syntax for deleting files/directories and reporting what was deleted

Posted by Maslow on Stack Overflow See other posts from Stack Overflow or by Maslow
Published on 2010-06-01T17:02:29Z Indexed on 2010/06/02 6:33 UTC
Read the original article Hit count: 221

Filed under:

Vs2010 .net 4.0 targeted project if that affects the answers at all.

I want to delete the bin and obj directories and output a message for the path of what was deleted.

<Target Name="CleanOutputs" Condition="'$(MvcBuildViews)'=='true'">
    <Message Text="Cleaning Outputs" Importance="high"/>
    <RemoveDir Directories="$(OutputPath);obj" RemovedDirectories="@(removed)" />
    <Message Text="Removed: %(removed.FullPath)" Importance="high"/>
    <Message Text=" "/>
    <!--<RemoveDir Directories="obj" />-->
    <MakeDir Condition="!Exists('$(OutputPath)')" Directories="$(OutputPath)" />
</Target>

Is what I have, but the Removed: message never shows.

© Stack Overflow or respective owner

Related posts about msbuild