| title | RemoveDir Task | |||
|---|---|---|---|---|
| description | Learn how MSBuild uses the RemoveDir task to remove the specified directory and all of its files and subdirectories. | |||
| ms.date | 11/04/2016 | |||
| ms.topic | reference | |||
| f1_keywords | ||||
| dev_langs |
|
|||
| helpviewer_keywords |
|
|||
| author | ghogen | |||
| ms.author | ghogen | |||
| ms.subservice | msbuild |
Removes the specified directories and all of its files and subdirectories.
The following table describes the parameters of the RemoveDir task.
| Parameter | Description |
|---|---|
Directories |
Required xref:Microsoft.Build.Framework.ITaskItem[] parameter.Specifies the directories to delete. |
RemovedDirectories |
Optional xref:Microsoft.Build.Framework.ITaskItem[] output parameter.Contains the directories that were successfully deleted. |
In addition to the parameters listed above, this task inherits parameters from the xref:Microsoft.Build.Tasks.TaskExtension class, which itself inherits from the xref:Microsoft.Build.Utilities.Task class. For a list of these additional parameters and their descriptions, see TaskExtension base class.
The following example removes the directories specified by the OutputDirectory and DebugDirectory properties. These paths are treated as relative to the project directory.
<Project>
<PropertyGroup>
<OutputDirectory>\Output\</OutputDirectory>
<DebugDirectory>\Debug\</DebugDirectory>
</PropertyGroup>
<Target Name="RemoveDirectories">
<RemoveDir
Directories="$(OutputDirectory);$(DebugDirectory)" />
</Target>
</Project>