Skip to content
This repository has been archived by the owner on Jan 25, 2019. It is now read-only.

FileNotFoundException: Could not load file or assembly 'System.Drawing.Common, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. #43

Closed
deanilvincent opened this issue Mar 5, 2018 · 4 comments

Comments

@deanilvincent
Copy link

Summary of the issue

I had an issue similar to this dll error: #40

So followed your steps in fixing by installing EPPlus.Core (1.5.2) and created a gdiplus.dll same to this #40 (comment)

Now the error has been changed to

FileNotFoundException: Could not load file or assembly 'System.Drawing.Common, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.

Environment

The in-use version: 1.5.2
Operating system:
Development Env: Windows 10 and the package is working.
Production Env: Ubuntu 16.04 (This is where the problem appears after I published my app)
IDE: Visual Studio 2017

Example code/Steps to reproduce:

Output:

Exception message: FileNotFoundException: Could not load file or assembly 'System.Drawing.Common, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.

screen shot 2018-03-05 at 2 54 03 pm

@VahidN
Copy link
Owner

VahidN commented Mar 5, 2018

I suggest start using the original EPPlus, because it now supports .NET Standard 2 too:
https://www.nuget.org/packages/EPPlus/4.5.0.2-rc

Also If you want to use the current package, install the last version (1.5.4) and then update your System.Drawing.Common dependency. This official package has 3 updates now:
https://www.nuget.org/packages/System.Drawing.Common/

@deanilvincent
Copy link
Author

deanilvincent commented Mar 5, 2018

I was using version 1.5.4 though. But the error was something similar to Unable to load DLL 'libdl'

@VahidN
Copy link
Owner

VahidN commented Mar 5, 2018

v1.5.4 doesn't use the last System.Drawing.Common by default. Try to add or update this dependency.
Also about Unable to load DLL 'libdl' error in containers, they are suggesting:

  • Install libgdiplus and libc6-dev in your container (If you're on Ubuntu or Debian, you can try to install the libc6-dev package to get libdl.so).
  • Check /usr/lib/x86_64-linux-gnu/libdl.so file exists inside your container.
  • If it still fails, you can try setting LD_LIBRARY_PATH to $LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu but that should be included already.
  • If that still fails, you can set the LD_DEBUG environment variable to libs in your Dockerfile, restart your container.

@deanilvincent
Copy link
Author

Thank you @VahidN

I fixed mine by installing the following:

  • v1.5.4
  • apt-get install libc6-dev until I successfully see the libdl.so

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants