MakeDir 任务MakeDir task

创建目录,并在必要时创建任何父目录。Creates directories and, if necessary, any parent directories.

参数Parameters

下表描述了 MakeDir 任务的参数。The following table describes the parameters of the MakeDir task.

参数Parameter 说明Description
Directories 必选 ITaskItem[] 参数。Required ITaskItem[] parameter.

要创建的目录集。The set of directories to create.
DirectoriesCreated 可选的 ITaskItem[] 输出参数。Optional ITaskItem[] output parameter.

由此任务创建的目录。The directories that are created by this task. 如果无法创建某些目录,则其中可能不包含已传递到 Directories 参数的所有项。If some directories could not be created, this may not contain all of the items that were passed into the Directories parameter.

备注Remarks

除上面列出的参数外,此任务还从 TaskExtension 类继承参数,后者自身继承自 Task 类。In addition to the parameters listed above, this task inherits parameters from the TaskExtension class, which itself inherits from the Task class. 有关这些其他参数的列表及其说明的信息,请参阅 TaskExtension 基类For a list of these additional parameters and their descriptions, see TaskExtension base class.

示例Example

以下代码示例使用 MakeDir 任务创建由 OutputDirectory 属性指定的目录。The following code example uses the MakeDir task to create the directory specified by the OutputDirectory property.

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

    <PropertyGroup>
        <OutputDirectory>\Output\</OutputDirectory>
    </PropertyGroup>

    <Target Name="CreateDirectories">
        <MakeDir
            Directories="$(OutputDirectory)"/>
    </Target>

</Project>

另请参阅See also