Поделиться через


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.
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 xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

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

</Project>

See also