In my published .Net Core 6 application I get an error, when I call a ZipArchive method.
The code which is called, looks like this:
using (var zipArchive = new ZipArchive(stream, ZipArchiveMode.Read))
{
foreach (var entry in zipArchive.Entries)
{
// Do some stuff.
}
}
My publish settings are as followed:
When the mentioned code is called I get this error:
System.IO.FileNotFoundException: Could not load file or assembly ‘System.IO.Compression.ZipFile, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’. The system cannot find the file specified.
File name: ‘System.IO.Compression.ZipFile, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’
The folder, containing the published exe, contains the missing System.IO.Compression.ZipFile.dll, with the following properties.
Is the problem that my app is looking for the 6.0.0 version, but I have a higher one? How can I fix this issue inside my app?