Cannot find `ZipArchive` in the “System.IO.Compression” namespace

后端 未结 3 741
不思量自难忘°
不思量自难忘° 2021-01-07 19:12

My question is related to I didn't find "ZipFile" class in the "System.IO.Compression" namespace

But I have referenced the DLL\'s f

相关标签:
3条回答
  • 2021-01-07 19:40

    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.

    0 讨论(0)
  • 2021-01-07 19:40
    using (var zip = new ZipArchive(System.IO.File.OpenRead(zipFileName))) { ... }
    
    0 讨论(0)
  • 2021-01-07 19:58

    I faced same problem because the namespace is not present in References,Please do the following steps.

    In my case Without References

    After Installing References

    Solution

    1)Install system.Io.compression from nuget here

    System.IO.Compression

    2)Install system.Install-Package 40-System.IO.Compression.FileSystem from nuget here.

    System.IO.Compression.FileSystem

    0 讨论(0)
提交回复
热议问题