Home Running a .NET Core 2.0 C# module, with OpenCV, in a nanoserver Docker container
Reply: 0

Running a .NET Core 2.0 C# module, with OpenCV, in a nanoserver Docker container

user10087
1#
user10087 Published in September 19, 2018, 11:03 am

I have a very basic C# .NET Core 2.0 application which uses a couple of 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 file.

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 compiling 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:

FROM microsoft/dotnet:2.0.0-runtime-nanoserver-1709

ARG EXE_DIR=.

WORKDIR /app

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 file we're executing.

The program runs in a windowsservercore-based image with .NET installed on it perfectly on my development 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).
share|improve this question
  • Does your code work in server core image? – Gregory Suvalian Apr 16 at 0:21
  • @GregorySuvalian Is there a server core based dotnet image for me to try? – Hammatt Apr 16 at 0:44
  • There is none but you can just with based servercore image and install dotnet core on it (docs.microsoft.com/en-us/dotnet/core/tools/…) – Gregory Suvalian Apr 16 at 11:56
  • I'm trying to create a new image based off windowsservercore to check if that works but it's taking a very long time to download, I'll report back when it does something. Thanks. – Hammatt Apr 16 at 23:40
  • Yes, it does work in a windowsservercore image. But windowsserver core does not run on windows 10 iot core. – Hammatt Apr 18 at 1:07

1 Answer 1

active oldest votes
up vote 0 down vote
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 2.288394 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO