Could not load file or assembly 'System.IO.Compression
Closed this issue · 6 comments
Since version 8.13.7 ( 8.13.8+ ) we get the Could not load file or assembly 'System.IO.Compression Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified. error
The project includes the System.IO.Complression dependicy v4.3.0 and the file exists in the bin folder.
.net 4.8 webforms project, with related .netstandard 2.0 project which both includes the libphonenumber package.
Can you provide sample code to reproduce this? Test netframework 4.8 app seems to work fine.
I set up a 4.8 web forms app with a .net standard 2.0 class library - both with libphonenumber-csharp 8.13.8
and it works fine.
Do you have a binding redirect?
Edit to add: I was able to reproduce the error if the oldVersion
range is not 0.0.0.0-4.0.0.0
. Is it set to 0.0.0.0-4.3.0.0
?
<dependentAssembly>
<assemblyIdentity name="System.IO.Compression" publicKeyToken="b77a5c561934e089" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
Indeed 0.0.0.0-4.3.0.0
<dependentAssembly>
<assemblyIdentity name="System.IO.Compression" culture="neutral" publicKeyToken="b77a5c561934e089" />
<bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0" />
</dependentAssembly>
Use newVersion="4.0.0.0"
, that's the version included with .NET Framework 4.8.
This is likely related to Assembly versions higher than 4.0.0.0 for System.IO.Compression.ZipFile cannot be loaded without a binding redirect. This was resolved in 4.7.2 - the 4.8 test app I have works fine without the redirect.
Hmm, that did not resolve this issue.. Created a workaround by removing the references in the .net2.0standard libary and moved the functions used to the .net4.8 projects. ( generic function for multiple project exists now in multiple projects instead of only in the generic library)