2013-07-04 49 views
0

我試圖使用MSBuild.Community.Tasks.Unzip提取壓縮文件(* .zip)。MSBuild.Community.Tasks.Unzip在0 KB大小的內容文件上失敗

但是,因爲我的壓縮文件包含0 KB大小的某些文件,通過這個原因,它與下面的錯誤而失敗:

error MSB4018: The "Unzip" task failed unexpectedly. 
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. 
Parameter name: length 
    at ICSharpCode.SharpZipLib.Zip.Compression.Streams.InflaterInputBuffer.ReadClearTextBuffer(Byte[] outBuffer, Int32 offset, Int32 length) 
    at ICSharpCode.SharpZipLib.Zip.ZipInputStream.BodyRead(Byte[] b, Int32 off, Int32 len) 
    at ICSharpCode.SharpZipLib.Zip.ZipInputStream.InitialRead(Byte[] destination, Int32 offset, Int32 count) 
    at ICSharpCode.SharpZipLib.Zip.FastZip.ExtractFileEntry(ZipEntry entry, String targetName) 
    at ICSharpCode.SharpZipLib.Zip.FastZip.ExtractZip(String zipFileName, String targetDirectory, Overwrite overwrite, ConfirmOverwriteDelegate confirmDelegate, String fileFilter, String directoryFilter) 
    at MSBuild.Community.Tasks.Unzip.Execute() 
    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() 
    at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask, Boolean& taskResult) 

我沒有在我的輸出文件夾需要這些文件。所以如果可能的話,甚至可以從提取中排除它。

任何想法來解決這個問題是高度讚賞?

有沒有什麼辦法可以在使用MSBuild.Community.Tasks.Unzip解壓縮時排除這些文件?

回答

0

此問題是由我正在使用的MSBuild.Community.Tasks的舊版本(1.2.0.306)導致的。這是內部引用ICSharpCode.SharpZipLib.dll版本0.84做解壓任務。此問題是ICSharpCode.SharpZipLib.dll版本0.84中已知的bug,它已經在版本0.86中進行了修復。

現在,我升級了我的MSBuild.Community.Tasks到版本1.4.0.42,它正常工作。這就解決了我的問題。