1

My problem today is that I'm trying to retrieve the version of a file that is located within a zip. I'm doing so in C#.

Just for context, what happens is that a 3rd party places builds of software onto a test server, and I'm manually updating the wiki with the version information.

I've thus far created the wikibot (not difficult), the difficulty appears to how I'm going to go about retrieving the version.

Any help is appreciated, thanks!

Nicky40
  • 35
  • 3
  • You must obviously extract zip content, use [SharpZipLib](http://sharpdevelop.net/OpenSource/SharpZipLib/) – Tomas Voracek Jul 27 '11 at 20:55
  • This is not very clear. Are you saying that you have a zip file on a server that contains a file and you want to get the version of that file? If so you need to get the zip file, extract the contents and then get the version for the file – ScruffyDuck Jul 27 '11 at 20:55
  • @Tomas why SharpZipLib instead of the built in functionality? – Yuriy Faktorovich Jul 27 '11 at 21:13
  • @Yuriy .NET doesn't have Zip support yet...Only GZip and Deflate http://msdn.microsoft.com/en-us/library/system.io.compression.aspx – Tomas Voracek Jul 27 '11 at 21:39
  • @Tomas he didn't mention which Zip format was used to compress it, I'm guessing the GZip should be able to handle it. – Yuriy Faktorovich Jul 27 '11 at 22:02

1 Answers1

2

First unzip the file (using a 3rd-party tool like SharpZipLib etc., or using System.Io.Compression). Then use FileVersionInfo.FileVersion to get your file version. Voila!

dizzwave
  • 4,013
  • 1
  • 19
  • 16