This project is read-only.

DotNetZip How do I get the entry file version?

Oct 18, 2010 at 4:50 PM

I have looked in all examples and do not see any please when reading a zip file using DotNetZip where to retrieve the File/Entry Version.
I need to compare file in zip to target file.


Oct 18, 2010 at 10:23 PM

What do you mean by "File/Entry Version"? 

A zip file stores metadata for each entry in the archive.  This metadata includes things like time/date stamps for last modified date, created date, and last accessed date; size of the file; a crc32 checksum of the file data; and a few other items.  (You can learn the full list of metadata by reading the zip specification; most of these metadata are accessible as properties on the ZipEntry object).  There is a "version required to extract" field, but this refers to the minimum version of the zip specification that must be supported by an extracting program (zip entries created using newer versions of the zip spec can employ newer features, such as Unicode filenames, or AES encryption).  The "version required to extract" number does not refer to the entry itself. 


Oct 19, 2010 at 3:25 AM

Regarding What do you mean by "File/Entry Version"?
I have several dll’s in a zip file that I need to retrieve the version.
Like one dll is 1.8.9 and another is 4.6.9.
When I read the zip with the metadata like timestamp I see
no way to view the version for that file.

Lance Coffman

Applications Programmer

PODS Enterprises, Inc.

5585 Rio Vista Drive | Clearwater, FL 33760

Phone: 727-538-6523 | Fax: 727-524-4500


Oct 24, 2010 at 3:31 PM
Edited Oct 24, 2010 at 4:59 PM

Update.  My original response here was wrong.

That file version information is embedded in the DLL file itself. Windows Explorer is smart enough to know to look into any file with a .DLL extension, and display that version number on the properties tab.  It is not something that is simply accessible, though, in the set of ZipEntry metadata.

To get the file version of the DLL, you'd need to have some code that inspects the DLL itself, and learns the embedded version number.  You can do this using the .NET Framework class System.Diagnostics.FileVersionInfo on a filesystem file.  See here.

So I think to do what you want, you'd have to extract the DLL to a temporary file, then create a FileVersionInfo object for that temporary file, and examine the FileVersion property on that object.

Oct 24, 2010 at 4:16 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.