在“ System.IO.Compression”命名空间中找不到“ ZipArchive” [英] Cannot find `ZipArchive` in the “System.IO.Compression” namespace

查看:547
本文介绍了在“ System.IO.Compression”命名空间中找不到“ ZipArchive”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题与



但是我为我的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 />
< / assembly>

来自



安装参考文件后




解决方案



1 )从nuget处安装system.Io.compression



System.IO.Co



2)从nuget安装系统.Install-Package 40-System.IO.Compression.FileSystem。



System.IO.Compression.FileSystem


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#"

解决方案

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

这篇关于在“ System.IO.Compression”命名空间中找不到“ ZipArchive”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆