문제

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?

도움이 되었습니까?

해결책

This issue was caused by the old version (1.2.0.306) of MSBuild.Community.Tasks which I was using. This is inturn referring ICSharpCode.SharpZipLib.dll version 0.84 for doing the Unzip task. This issue is a known bug in ICSharpCode.SharpZipLib.dll version 0.84 and it already have a fix in version 0.86.

Now, I upgraded my MSBuild.Community.Tasks to version 1.4.0.42 and it is working fine with that. So that fixes my issue.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top