Windows Phone 7 Issues

Jul 14, 2010 at 10:25 PM
I'm trying to use dotnetziplib in a Windows Phone 7 project, but (with the Beta WP7 build tools) I am being told that I can't add a reference to the DLL because it isn't a Windows Phone assembly. Is everyone seeing this problem? (or is it just a something screwy with my setup?). If it's a general problem, is there a solution out there? (for instance a WP7-compatible build of the DLL) Thanks.
Aug 18, 2010 at 10:39 AM

I've just added the Compact Framework version (Ionic.Zip.CF.dll) to a project without seeing this error.

I'll report back if I can actually get it working.

Aug 18, 2010 at 1:11 PM
This seems to work Ok, but doesn't support extracting a multi-part/file zip from isolated storage. Whichi is what I was trying to do. :(
Coordinator
Aug 20, 2010 at 11:56 AM
I can't recall now, whether spanned zip capability is included in the CF version of the library, and I'm not able to look at the code or the doc at the moment to find out. Check and see. Of it IS supported, then pls post details of what does t work. Thanks.
Feb 7, 2011 at 6:09 PM

HI,

 

i am trying to unzip files in WP7 but i can't import the dll since is not Windows Phone assembly. were you able to do this?

 

Thanks

Feb 7, 2011 at 8:05 PM
You need a version of the DLL that has been built for WP7. You'll have to build one from the source files; I spent some time doing that but got bored before I got it working. Instead, I used SharpZipLip (attached). By the way - you do always have the alternative of using the WP7 built-in ZIP extractor, Application.GetResourceStream(). Though for that, you do need to know the name of the file you're looking for.

Jim

On 07/02/2011 18:09, joe77 wrote:

From: joe77

HI,

i am trying to unzip files in WP7 but i can't import the dll since is not Windows Phone assembly. were you able to do this?

Thanks

Oct 11, 2012 at 3:39 PM

The problem with using SharpZipLib is it is released under the GPL (with an exception that allows the binary to be redistributed). GPL components are not allowed in applications released on the Windows Marketplace.

Some internet opinion suggests that the specified exception to the GPL means that it would be allowed, but I had our legal department review the Marketplace agreement and the SharpZipLib license, and they thought that it would not be allowed. In any case, to play it safe, we decided not to use SharpZipLib.

It isn't too hard to get DotNetZip compiled and working for Windows Phone - the steps I followed to get it working for me:

  • Download the full source. Extract just the directories you need (BZip2, CommonSrc, Zip, Zlib).
  • Create a new Windows Phone 7.1 project. Copy all the files from the Zip CF project into this new project.
  • Define the NETCF constant on the new project build page (for both Debug and Release)
  • On ZipFile, create a new static member with type IsolatedStorageFile, and initialize it to the application's isolated storage
  • Replace all the File operations with isolated storage operations e.g.
    • File.Open --> ZipFile.IsoStorage.OpenFile
    • File.Delete --> ZipFile.IsoStorage.DeleteFile
    • File.Exists --> ZipFile.IsoStorage.FileExists

Hope this helps anyone trying the same thing.

Pete

Oct 11, 2012 at 4:03 PM

Oh yes, and I had to replace all the IBM text encodings with UTF8.

Pete

Nov 9, 2012 at 1:00 AM

The IBM text encoding is the default used in ZIPs for filenames I think. Using UTF8 means that for example Windows Vista/7 zipped folders won't be able to open those zip files to navigate in them (in case you care about that)