ZipDirectory task

Creates a .zip archive from the contents of a directory.


The ZipDirectory task is available in MSBuild 15.8 and above only.


The following table describes the parameters of the ZipDirectory task.

Parameter Description
DestinationFile Required ITaskItem parameter

The full path to the .zip file to create.
Overwrite Optional Boolean parameter.

If true, skips the destination file will be overwritten if it exists. Defaults to false.
SourceDirectory Required ITaskItem parameter.

Specifies the directory to create a .zip archive from.


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.


The following example creates a .zip archive from the output directory after building a project.

<Project xmlns="">

    <Target Name="ZipOutputPath" AfterTargets="Build">
            DestinationFile="$(MSBuildProjectDirectory)\" />


See also