opencvsharp icon indicating copy to clipboard operation
opencvsharp copied to clipboard

Unable to load DLL 'OpenCvSharpExtern' or one of its dependencies

Open NonicaTeam opened this issue 1 year ago • 1 comments

Summary of your issue

Environment

Net8.0

What did you do when you faced the problem?

Migrate Opencvsharp4.0 from net framework to net8.0 using visual studio migration. As it was raising the issue, I uninstall and reinstall different versions but I am unable to get it working. I have OpenCVSharp4 and OpenCVSharp4.runtime.win installed and built in my output directory. I also tried to copy the runtimes (opencv_videoio_ffmpeg490_64.dll, OpenCvSharpExtern.dll) next to the main OpenCvSharp.dll but it did not work either. I have tried soo many solutions online but could not get it working. Taget framework is x64 and those dll were copied next to main dll. I also added System.memory and system.compiler.unsafe next to it.

Example code:

var edgedetection = Cv2.ImRead(init_hdlr_image);

Output:

DllNotFoundException: Unable to load DLL 'OpenCvSharpExtern' or one of its dependencies: The specified module could not be found. (0x8007007E)
System.TypeInitializationException: 'The type initializer for 'OpenCvSharp.Internal.NativeMethods' threw an exception.'

What did you intend to be?

No error and loading properly

NonicaTeam avatar Apr 20 '24 06:04 NonicaTeam

It looks like some dll missing, you can check this first.

AvenSun avatar May 07 '24 02:05 AvenSun

Hi @NonicaTeam, did you manage to resolve this? I'm also trying to migrate to net8.0 Thanks Jim

jimquittenton avatar Sep 05 '24 13:09 jimquittenton

Hi @NonicaTeam, did you manage to resolve this? I'm also trying to migrate to net8.0 Thanks Jim

Yes, we found that Windows have versions ended with N, like Windows 10 Home N. Those versions do not include something called Media Feature Pack which is needed for this library. We were testing in one N version, that is the limitation we found.

I hope it helps

NonicaTeam avatar Sep 05 '24 13:09 NonicaTeam