views:

547

answers:

1

I wrote the following Nant script on my Vista dev machine and was pleased as punch with the output of the Nant zip task, as I can unzip it with any problems:

<zip zipfile="${dir.build}CeoConfigUtilities.${build-version}.zip">
   <fileset basedir="${dir.configutilities}" prefix="CeoConfigUtilities">
      <include name="**" />
   </fileset>
</zip>

I checked the Nant script into SVN, and the build server zipped up my files without a problem. I tested and found I can unzip those on my Vista machine too. Life and Nant are good, right? Well, others get the following message when unzipping these files on Windows XP Pro:

The Compressed (zipped) Folder is invalid or corrupted.

I took the files produced on my machine to an XP machine and got the same message. One difference I notice is that, when I open the zip using XP's built-in tools, it says the compression ratio for each file is 100%. Using jZip on Vista, each file has a different, non-100% ratio.

Has anyone experienced anything like this? Is there some setting I don't know about to make the output of the Nant zip task be unzippable on XP? Nant was working out so well for me that I'll be disappointed if this silly unzip issue fouls things up for XP users.

A: 

I found the answer to my question lies not in Nant script but a version incompatibility that I thought I was being clever by working around via an assembly version redirection. That teaches me for thinking I am clever!

It turns out that the distro of Nant I had my hands on (the one checked into the StructureMap SVN repository) contains two different versions of SharpZipLib. In lib, SharpZipLib.dll is version 0.85.5.452. In lib\common\neutral, SharpZipLib.dll is version 0.85.1.271. Adding a zip task yielded an assembly binding error, so I added the following to Nant.exe.config:

<dependentAssembly> 
   <assemblyIdentity name="ICSharpCode.SharpZipLib" publicKeyToken="1b03e6acf1164f73" culture=""/>
   <bindingRedirect oldVersion="0.85.1.271" newVersion="0.85.5.452"/>
</dependentAssembly>

I thought DLL Hell was dead and I also thought I had outsmarted whatever new hell we are in now. As it turns out, I should have simply copied the old version in lib\commmon\neutral over the new version in lib.

Now my build server produces files that can be unzipped on XP.

flipdoubt