Share via


RemoveDir Task

Note

This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

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.

Remarks

In addition to the parameters listed above, this task inherits parameters from the TaskExtension class, which itself inherits from the Task class. For a list of these additional parameters and their descriptions, see TaskExtension Base Class.

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="https://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

Tasks
Task Reference