我的问题与 I didn't find "ZipFile" class in the "System.IO.Compression" namespace 有关
但我已经为我的 4.5.1 webforms 项目引用了 DLL:
我项目的属性给我:目标框架:.Net Framework 4.5.1。
和 web.config:
<compilation debug="true" targetFramework="4.5" />
我错过了什么?
解决方案是手动引用 web.config 中的程序集但是为什么呢?为什么添加引用对话框中的复选框不够用?
<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>
取自this answer到“已安装 .Net 4.5 但不能在 Visual C# 中使用 ZipFile 类”
最佳答案
我遇到了同样的问题,因为引用中不存在命名空间,请执行以下步骤。
在我没有引用的情况下
安装引用后
1)在此处从 nuget 安装 system.Io.compression
2) 从此处的 nuget 安装 system.Install-Package 40-System.IO.Compression.FileSystem。
关于c# - 在 `ZipArchive` 命名空间中找不到 “System.IO.Compression”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33802239/