.NET Framework General Reference
RemoveDir Task

Removes the specified directories and all of its files and subdirectories.

Parameters

The following table describes the parameters of the RemoveDir task.

Parameter

Description

Directories

Required ITaskItem[] parameter.

Specifies the directories to delete.

RemovedDirectories

Optional ITaskItem[] output parameter.

Contains the directories that were successfully deleted.

Example

The following example removes the directories specified by the OutputDirectory and DebugDirectory properties. These paths are treated as relative to the project directory.

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2005">

    <PropertyGroup>
        <OutputDirectory>\Output\</OutputDirectory>
        <DebugDirectory>\Debug\</DebugDirectory>
    </PropertyGroup>

    <Target Name="RemoveDirectories">
        <RemoveDir
            Directories="$(OutputDirectory);$(DebugDirectory)" />
    </Target>

</Project>
See Also

Concepts

Other Resources

Tags :


Community Content

Mike Fourie
RemovedDirectories will contain directories that don't exist
"Contains the directories that were successfully deleted." is not 100% accurate.

If you pass in a folder that does not exist, then this folder will also be added to the RemovedDirectories collection.
Tags :

Page view tracker