ZipTask Class

Summary

Creates a zip file from the specified filesets.
Assembly
NAnt.Compression.dll
Namespace
NAnt.Compression.Tasks
Base Types
  • Task
graph BT Type-->Base0["Task"] Type["ZipTask"] class Type type-node

Syntax

[TaskName("zip")]
public class ZipTask : Task

Examples

Zip all files in ${build.dir} and ${doc.dir} into a file called "backup.zip".

    <zip zipfile="backup.zip">
    <fileset basedir="${bin.dir}" prefix="bin">
        <include name="**/*" />
    </fileset>
    <fileset basedir="${doc.dir}" prefix="doc">
        <include name="**/*" />
    </fileset>
</zip>

Remarks

Uses #ziplib (SharpZipLib), an open source Tar/Zip/GZip library written entirely in C#.

Attributes

Type Description
TaskName

Properties

Name Value Summary
Comment string
The comment for the file.
DuplicateHandling DuplicateHandling
Specifies the behavior when a duplicate file is found. The default is NAnt.Compression.Types.DuplicateHandling.Add.
Encoding Encoding
The character encoding to use for filenames and comment inside the zip file. The default is the system's OEM code page.
Flatten bool
Ignore directory structure of source directory, compress all files into a single directory. The default value is false.
IncludeEmptyDirs bool
Include empty directories in the generated zip file. The default is false.
PassWord string
The password to protect the Zip.
Stamp DateTime
Date/time stamp for the files in the format MM/DD/YYYY HH:MM:SS.
ZipFile FileInfo
The zip file to create.
ZipFileSets ZipFileSetCollection
The set of files to be included in the archive.
ZipLevel int
Desired level of compression. Possible values are 0 (STORE only) to 9 (highest). The default is 6.

Methods

Name Value Summary
ExecuteTask() void
Creates the zip file.