2

I have the following code to extract a single file from a ziparchive.

public void ExtractSingleFile(string fileName,string source)
{
    var archive = OpenRead(source);
    var entry = archive.GetEntry(fileName);
    entry.ExtractToFile(Path.Combine("/temp", fileName));
}

When running, I get the following error:

System.MissingMethodException: 'Methode not found: Void System.IO.Compression.ZipFileExtensions.ExtractToFile(System.IO.Compression.ZipArchiveEntry, System.String).'

Does anybody knows how to fix this?

I tried cleaning and rebuilding, searched for updates and nuget and re-added the references as mentioned in this post

  • 1
    Possible duplicate of [How to resolve the Method not found in C#?](https://stackoverflow.com/questions/44740302/how-to-resolve-the-method-not-found-in-c) – Lucifer Jun 12 '18 at 08:40
  • 5
    @Nkosi that would be a compilation error. As a runtime error, it means that the code is compiling against one version, but running with a different version (usually: older) of System.IO.Compression.FileSystem.dll - one that lacks that method – Marc Gravell Jun 12 '18 at 08:45
  • @MarcGravell got it. totally missed the `when running` part – Nkosi Jun 12 '18 at 08:46
  • What version of .Net are you running? – Nkosi Jun 12 '18 at 08:47
  • @Nkosi Version 4.6.1 – Ronald Elzen Jun 12 '18 at 08:54
  • Stay away from Nuget, you want to have as little to do with .NETCore as you can. Diagnose this with the Fuslogvw.exe, log all binds and show us the trace for System.IO.Compression.FileSystem.dll – Hans Passant Jun 12 '18 at 10:41

0 Answers0