I have a C# .NET (v4.6.2) WinForms app where I'm accessing a file that may/may not be a .zip archive that was created using System.IO.Compression. I have both System.IO.Compression and System.IO.Compress.FileSystem references in the project and referencing System.IO.Compression in the .cs file
I'm getting the error
"could not read file from disk. (Error: method not found: 'Void system.io.compression.zipfile.extensions.extractToFile(System.IO.Compression.ZipArchiveEntry, system.string)'"
It looks like the issue, based on the error, is in the ExtractToFile
command, though I can't figure out where to start to fix this.
Below is the code for attempting to open the file as a .zip archive:
using (ZipArchive archive = new ZipArchive(File.OpenRead(zipPath), ZipArchiveMode.Read))
{
foreach (ZipArchiveEntry entry in archive.Entries)
{
if (entry.FullName.EndsWith(".wco3", StringComparison.OrdinalIgnoreCase))
{
entry.ExtractToFile(Path.Combine(extractPath, entry.FullName));
}
}
if (File.Exists(DestPath + DestFile))
{
Success = Succeeded;
}
}