Language
Edit

Unzip task

Unzips a .zip archive to the specified location.

Note

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

Parameters

The following table describes the parameters of the Unzip task.

Parameter Description
DestinationFolder Required ITaskItem parameter

Specifies the destination folder to unzip the file to.
Exclude Optional String parameter.

Specifies one or more semicolon-separated MSBuild glob patterns for archive entries to exclude. Exclusion takes precedence over inclusion. Available in MSBuild 16.10 and later.
Include Optional String parameter.

Specifies one or more semicolon-separated MSBuild glob patterns for archive entries to include. If omitted, all entries are included unless excluded. Available in MSBuild 16.10 and later.
OverwriteReadOnlyFiles Optional Boolean parameter.

If true, overwrites read-only files. Defaults to false.
SkipUnchangedFiles Optional Boolean parameter.

If true, skips unzipping files that are unchanged. Defaults to true. The Unzip task considers files to be unchanged if they have the same size and the same last modified time.
SourceFiles Required ITaskItem[] parameter.

Specifies one or more the files to unzip. When specifying multiple files they are unzipped in order to the same folder.

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 unzips an archive and overwrites any read-only files.

<Project>

    <Target Name="UnzipArchive" BeforeTargets="Build">
        <Unzip
            SourceFiles="MyArchive.zip"
            DestinationFolder="$(OutputPath)\unzipped"
            OverwriteReadOnlyFiles="true"
        />
    </Target>

</Project>

See also