Add Files or Folders to ZIP Archives Programmatically in C# April 22, 2020 · 5 min · Usman Aziz. The ZIP archives are used to compress and keep one or more files or folders into a single container. A ZIP archive encapsulates the files and folders as well as holds their metadata information.
My question is related to I didn't find "ZipFile" class in the "System.IO.Compression" namespace
But I have referenced the DLL's for my 4.5.1 webforms project:
Properties of my project give me: Target framework: .Net Framework 4.5.1.
and the web.config:
<compilation debug="true" targetFramework="4.5" />
What am I missing?
The solution was to manually reference the assemblies in the web.config But why? Why wasn't the checkbox in the add reference dialog insufficient?
<assemblies> <add assembly="System.IO.Compression, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /> <add assembly="System.IO.Compression.FileSystem, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /> </assemblies>
Taken from this answer to "Installed .Net 4.5 but can't use ZipFile class in Visual C#"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With