#726 zip task should create a folder

Tasks (408)

The current zip task in Nant v0.90

In the following example;
zipfile should create a folder structure ( ${root.dir}/${which.platform} ) with the zip file in that folder.
Currently, one has to use the mkdir task first to create the folder structure ${root.dir}/${which.platform}

<zip zipfile="${root.dir}/${archive}/test.zip">
<fileset basedir="${stage.dir}">
<include name="**/**"/>


  • Dominik Guder

    Dominik Guder - 2010-04-03

    I know that this would be helpfull, but IMHO when you are zipping a folder (in windows) with winzip when you won't get this main directory added to zip.
    But you might take a look into docu:
    <fileset basedir="${stage.dir}" prefix="${which.platform}"> to create your toplevel directory
    hth Dominik

  • fmhome

    fmhome - 2010-04-05

    Sorry for the confusion here...
    Let me clarify this issue.

    The issue is with zipfile attribute of zip task.
    <zip zipfile="${root.dir}/${archive}/test.zip">

    When the task is excuted, the task doesn't create the ${root.dir}/${archive} folder structure and fail, unless the structure is already there.
    Sometime, users want to put the final zip file in a different folder. Otherwise one has to use mkdir to create the dir structure first then call the zip task.

    IMO... This is an un-necesary additional step.

  • Dominik Guder

    Dominik Guder - 2010-04-05


    I see your point, but I don't see that zip task is responsible to create any parent directories if they not exists. Maybe someone will see this different, but zip task should deal with zip files not with dir layout.

    So I don't see any needs to change this. (This will also duplicate code.)

  • fmhome

    fmhome - 2010-04-09

    I understand what you are trying to say but, I think the code should be consistent across the board. If you look at the "Copy Task"

    It does the same and create the folder structure, if it doesn't exist already. Eventhough, you are copying 1 file.

    Also, to make my case stronger. The same zip task in ant creates the folder structure as well. Take a look at the ant examples here...


    Also, the NAnt zip task do not have a proper error message when it fails if the directory structure is not created in advance.

    I would and I am sure quite a few more people would appreciate if this can be modified.


  • Charles Chan

    Charles Chan - 2010-04-09
    • assigned_to: nobody --> cchan_qa
  • Dominik Guder

    Dominik Guder - 2010-04-10


    that's ok.
    In addition you also might check "CompilerBase.cs".
    Currently output dir must be created in advance. If not, a simple <csc> task will fail

  • Charles Chan

    Charles Chan - 2010-04-10

    Fixed in CVS:
    src/NAnt.Compression/Tasks/ZipTask.cs: 1.42
    tests/NAnt.Compression/Tasks/ZipTaskTest.cs: 1.14

    Please try in the next NAnt release.

    Dominik: I will create a separate issue for CompileBase.cs

  • Charles Chan

    Charles Chan - 2010-04-10
    • status: open --> closed-fixed
  • fmhome

    fmhome - 2010-04-10

    Thanks to everyone who were involved and for considering to fix this as an improvement.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks