My application is a Universal Window Platform application. I try to implement a Runtime Component to decompress a zipped folder. One of my requirements is that paths which are longer than 260 characters can be handled.
public static IAsyncActionWithProgress < string > Unzip(string zipPath, string destination) {
return AsyncInfo.Run < string > (async(_, progress) => {
var zipFile = await StorageFile.GetFileFromApplicationUriAsync(new Uri(zipPath));
try {
Stream stream = await zipFile.OpenStreamForReadAsync();
ZipArchive archive = new ZipArchive(stream);
archive.ExtractToDirectory(destination);
} catch (Exception e) {
Debug.WriteLine(e.Message);
}
});
}
I tried to execute my method getting following exception message:
System.IO.FileNotFoundException: Could not load file or assembly 'System.IO.Compression, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified.
at Zip.Zip.<>c__DisplayClass0_0.<<Unzip>b__0>d.MoveNext()
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
at Zip.Zip.<>c__DisplayClass0_0.<Unzip>b__0(CancellationToken _, IProgress`1 progress)
at System.Thread (~4340)
I tried to add System.IO.Compression with NuGet but I still get the same error. The zip file and the destination folder exist.
I tried to debug my project on Visual Studio 2015 instead of Visual Studio 2017 and found out that I can use System.IO.Compression in that way but there is a restriction for the length of paths.