我目前正在开发一个ASP.NET Core 1.0项目。我想同时留在dnxcore50和dnx451上。这使我现在遇到以下问题:解压在.Net中的归档核心1.0
如何将zip文件从文件系统解压缩到目录?
"System.IO.FileSystem.Primitives": "4.0.0-beta-22816",
"System.IO.FileSystem": "4.0.0-beta-22816"
"frameworks": {
"dnx451": {
"frameworkAssemblies": {
"System.IO": ""
}
},
"dnxcore50": {
"dependencies": {
"System.IO": "4.0.10-beta-*"
}
}
}
随着在project.json该配置现在我能得到一个GZipStream,但我不知道如何在流存储到一个目录。不幸的是,System.IO.Compression.ZipFile.ExtractToDirectory()方法中的ZipFile对象在核心框架中不存在:/。
UPDATE:
我现在包括它的方式,并从整体上依赖删除它:
"frameworks": {
"dnx451": {
"dependencies": {
"System.IO.Compression.ZipFile": "4.0.1-beta-23516"
}
},
"dnxcore50": {
"dependencies": {
"System.IO.Compression.ZipFile": "4.0.1-beta-23516"
}
}
当我使用的核心它能正常工作,但随着运行它运行应用程序.net framework 4.6我在运行时遇到以下情况:
n处理请求时发生未处理的异常。
An unhandled exception occurred while processing the request.
FileNotFoundException: Could not load file or assembly 'System.IO.Compression.ZipFile, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified.
嗯发现,[你确定](https://github.com/dotnet/corefx/blob/master/src/System.IO.Compression。的ZipFile/REF/System.IO.Compression.ZipFile.cs /#L15)? –
thx为您的答案。我发现我的错误。我使用System.IO.Compression.ZipFile 4.0.0的最后一个稳定版本,但它似乎已添加到4.0.1-beta-23516 @JoachimIsaksson –
更新了我的问题。你能再帮我一次吗? @JoachimIsaksson –