使用C#中的System.IO.Compression.Filesystem解压缩文件时出错 [英] Error in Unzip the file using System.IO.Compression.Filesystem in C#

查看:1032
本文介绍了使用C#中的System.IO.Compression.Filesystem解压缩文件时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用.Net framework 4.5,因为我在提取zip文件时使用了一个dll System.Io.Compression.filesystem







i使用以下代码



ZipFile.ExtractToDirectory(destfile,filedirectory);



但它显示错误,因为ZipFile在内容中不存在



警告:警告1主要参考System.IO.Compression.FileSystem 无法解决,因为它间接依赖于框架程序集System.IO.Compression,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089无法在当前目标框架中解析。 .NETFramework,版本= V4.0,外形=客户。要解决此问题,请删除引用System.IO.Compression.FileSystem或将应用程序重新定位到包含System.IO.Compression,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089的框架版本。

解决方案

感谢您的回答Mr.Arnaldo Skywalker ......



其实我确切的问题是我开发和构建应用程序是Net Framework 4.0,然后我实现的应用程序是.Net Framework 4.5,这就是一个问题。现在它的工作很好的朋友。



谢谢和问候,

G.Mariappan(A)Murugan


< blockquote>尝试使用nuget中的.dll。您只需在Google中键入nuget并下载解压缩文件包。


I am using .Net framework 4.5 ,in that i used a dll System.Io.Compression.filesystem

while extracting the zipfile

i use the following code

ZipFile.ExtractToDirectory(destfile, filedirectory);

but its shows an ERROR as ZipFile is doesnt exist in the content

WARNING as:Warning 1 The primary reference "System.IO.Compression.FileSystem" could not be resolved because it has an indirect dependency on the framework assembly "System.IO.Compression, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.0,Profile=Client". To resolve this problem, either remove the reference "System.IO.Compression.FileSystem" or retarget your application to a framework version which contains "System.IO.Compression, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089".

解决方案

Thanks for your answer Mr.Arnaldo Skywalker...

Actually that exact problem is I develop & build the application is Net Framework 4.0, then I implent the application is .Net Framework 4.5, So that is a problem. Now its working fine Friends.

Thanks & Regards,
G.Mariappan(A)Murugan


Try using a .dll from nuget. You only need to type nuget in Google and download a package for unzipping files.


这篇关于使用C#中的System.IO.Compression.Filesystem解压缩文件时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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