2013-07-04 52 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,它正常工作。这就解决了我的问题。