Cannot find `ZipArchive` in the “System.IO.Compression” namespace
you can update References in Project file directly (Unload Project and Edit this or open .csproj file with notepad and edit)
Before edit must same as:
<Reference Include="System.IO.Compression" />
<Reference Include="System.IO.Compression.FileSystem" />
After your edit:
<Reference Include="System.IO.Compression, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL" />
<Reference Include="System.IO.Compression.FileSystem, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL" />
load again your project in Visual Studio and rebuild it. I hope it can help you.
JP Hellemons
C# .Net (web) developer. twitter: jphellemons My blog: http://www.jphellemons.nl/ SOreadytohelp
Updated on September 24, 2020Comments
-
JP Hellemons over 3 years
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#"