Questions tagged [dotnetzip]

Questions dealing with the DotNetZip open-source zip library for .NET

DotNetZip is an open source zip library. DotNetZip works on PCs with the full .NET Framework, and also runs on mobile devices that use the .NET Compact Framework. Silverlight is also supported.

Below is an example of using the library with C#:

 using (ZipFile zip = new ZipFile())
 {
     // add this map file into the "images" directory in the zip archive
     zip.AddFile("c:\\images\\personal\\7440-N49th.png", "images");
     // add the report into a different directory in the archive
     zip.AddFile("c:\\Reports\\2008-Regional-Sales-Report.pdf", "files");
     zip.AddFile("ReadMe.txt");
     zip.Save("MyZipFile.zip");
 }

Note: Just for reference the project builds into Ionic.Zip.dll

Installation

DotNetZip can most easily be installed through its NuGet package.

Install-Package DotNetZip
460 questions
1
vote
2 answers

FileStream will not open Win32 devices such as disk partitions and tape drives. (DotNetZip)

I'm trying to use DotNetZip to handle zip files, but whenever I try to open a file I get the following error: [SEVERE] System.ArgumentException: FileStream will not open Win32 devices such as disk partitions and tape drives. Avoid use of "\\.\" in…
Doodles
  • 109
  • 1
  • 11
1
vote
2 answers

DotNetZip - Cannot access a closed Stream

None of the similar questions are quite what I'm looking for! What's wrong with the following code? files is a text array of file contents, and fileNames is the corresponding filename array. This code always fails at the second-last line with the…
CompanyDroneFromSector7G
  • 4,291
  • 13
  • 54
  • 97
1
vote
2 answers

Can't build my project in release mode with linking

Here is th exception I get when i try to run in release mode: 4> C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1124,3): error MSB4018: The "BuildApk" task failed unexpectedly. 4>C:\Program Files…
Adam Ivancza
  • 2,459
  • 1
  • 25
  • 36
1
vote
2 answers

Is there any way to create an empty folder using DotNetZip?

I'm trying to use DotNetZip to create a zip file in C#.NET. However, I do need to include empty folders from time to time. Is this possible? Are there any tricks to make it happen?
Narnian
  • 3,858
  • 1
  • 26
  • 29
1
vote
3 answers

How to pack a SFX file created with DotNetZip library without destroy the file?

I've created a self executable with DotNetZip library and now I will pack the exe. I've tried it with UPX, BoxedAPP, .NET Shrink and IlMerge, all of them destroys the SFX file. Important: The reason of why I'm trying to pack the SFX is because I…
ElektroStudios
  • 19,105
  • 33
  • 200
  • 417
1
vote
2 answers

DotNetZip Corruption after Rename

I am using the DotNetZip library to rename a file within a zip archive. Here is the code I am using: void RenameFile(string existingArchive, string oldName, string newName) { using (ZipFile zip = ZipFile.Read(existingArchive)) { …
Rotem
  • 21,452
  • 6
  • 62
  • 109
1
vote
1 answer

Why does GetBasicPropertiesAsync() sometimes throw an Exception?

In Windows8, I'm trying to use GetBasicPropertiesAsync() to get the size of a newly created file. Sometimes, but not always (~25% of the time), this call gives an exception of: "Access is denied. (Exception from HRESULT: 0x80070005…
Jay Borseth
  • 1,894
  • 20
  • 29
1
vote
0 answers

DotNetZip ExtractProgress events in PowerShell

I'm extracting a ZIP file in PowerShell by using the DotNetZip library, and I want to display progress. I'm using the following code: try { $zip = [Ionic.Zip.ZipFile]::Read($ZipFileName) Register-ObjectEvent ` -InputObject $zip…
Roger Lipscombe
  • 89,048
  • 55
  • 235
  • 380
1
vote
2 answers

Is it possible to change file content directly in zip file?

I have form with text box and customer wants to store all changes from this textbox to zip archive. I am using http://dotnetzip.codeplex.com and i have example of code: using (ZipFile zip = new ZipFile()) { zip.AddFile("text.txt"); …
Ievgen
  • 4,261
  • 7
  • 75
  • 124
1
vote
1 answer

Error while deserializing to json an unzipped string

I create a zip file and I copy in it a file that contains a serialized list of objects. The file encoding is in UTF8. Then I unzip the file and I try to deserialize it, but I will get this error: Unexpected character encountered while parsing value:…
user1472131
  • 411
  • 1
  • 5
  • 15
1
vote
1 answer

Is DotNetZip possible to restrucure directories in an archive file

My zip file has two levels of directory structure. I added a new directory at the root using AddDirectoryByName. Is it possible to move existing directories into the newly create directory? I like to have the zip file containing 3 levels of…
1
vote
2 answers

Writing and Loading files that are in the C# Project?

After much searching and looking extensively, I have a question that is undoubtedly dumb but I'm just missing something easy. I just published my first website and obviously had to make a few changes. I'm using a writer class, before it was just…
KJ3
  • 5,168
  • 4
  • 33
  • 53
1
vote
1 answer

How to debug corrupt zip file generation?

We have a web page that is grabs a series of strings from a url, finds some pdfs associated with those strings, zips them up using DotNetZip, and returns them to the user. The page that does this is very simple - here's the Page_Load: protected…
Beska
  • 12,445
  • 14
  • 77
  • 112
1
vote
1 answer

packaging files to be read without need for extraction

In my current project i'm dealing with a huge number of files (over tens of milliard files with low volume-between 1 and 30 KB) as resources which copying them for my customer is time consuming job. i'm searching for a packaging mechanism that can…
IT Seeker
  • 82
  • 8
1
vote
2 answers

zip and unzip files using DotNetZip

I am using DotNetZip. Using it to zip mp3 files. ZipFile zip = new ZipFile(); zip.Password = "123"; zip.AddFile("R:\\abc\\a\\a 2 z.mp3"); zip.Save("R:\\abc\\a\\aaa.zip"); After extraction of aaa.zip, I get a corrupted mp3 file. Having 3.31MB data…
whoone
  • 533
  • 3
  • 7
  • 16