1

I was trying to extract a compressed file (*.zip) using MSBuild.Community.Tasks.Unzip.

But, since my compressed file contains some files with 0 KB size, by that reason it is failing with the following error:

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)

I don't need these files in my output folder. So it can be even excluded from extraction if possible like that.

Any idea to tackle this issue is highly appreciated?

Is there any way to exclude these files during extraction using MSBuild.Community.Tasks.Unzip?

4

1 回答 1

1

此问题是由我使用的 MSBuild.Community.Tasks 的旧版本(1.2.0.306)引起的。这反过来又引用了 ICSharpCode.SharpZipLib.dll 0.84 版来执行解压缩任务。此问题是 ICSharpCode.SharpZipLib.dll 0.84 版中的一个已知错误,并且已在 0.86 版中修复。

现在,我将我的 MSBuild.Community.Tasks 升级到了 1.4.0.42 版本,它运行良好。这样就解决了我的问题。

于 2013-07-05T05:41:18.273 回答