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