我目前正在開發一個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 –