I have a very basic C# dotnet core 2.0 application which uses a couple very basic features of OpenCV as a proof of concept.
I'm trying to run this in a nanoserver container, eventually to be deployed as an IoT Edge module but I get an error saying that it cannot locate a dll.
Unhandled Exception: System.TypeInitializationException: The type initializer for 'OpenCvSharp.NativeMethods' threw an exception. --->
System.DllNotFoundException: Unable to load DLL 'OpenCvSharpExtern': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
I have tried compliling with just
dotnet publish IoTCoreCSharp.csproj and with
dotnet publish IoTCoreCSharp.csproj --runtime win10-x64 --configuration Debug --force both without luck.
My docker file looks like this:
COPY $EXE_DIR/ ./
COPY system32_opencvsharp_deps/ C:/Windows/System32
CMD ["dotnet" "IoTCoreCSharp.dll"]
system32_opencvsharp_deps contains avicap32.dll, avifil32.dll, msacm32.dll, msvfw32.dll, and vcruntime140.dll
OpenCvSharpExtern.dll is located in the root of the directory of the dll we're executing.
Edit: The program runs in a windowsservercore based image with dotnet installed on it perfectly on my dev machine, but this kind of image does not run on Windows 10 IoT Core which we need.
Error when trying to run on IoT Core:
c:\Program Files\docker\docker.exe: Error response from daemon: container
e9da3baa806f161153fdb7f60a9401a5ff46c32a959499cbe0bd822b1fc0dda3 encountered an error during Start: failure in a
Windows system call: The compute system exited unexpectedly. (0xc0370106).