none
How to install all dependent binaries required to execute native C++ DLL/EXE on windowsservercore Docker image RRS feed

  • Question

  • Hello,

    I am facing issue while using native C++ DLL into the C# .NET core app on windowsservercore Docker container. Getting following error when try to call exposed API from the native DLL using pInvoke from C# .NET Core application. 

    Error : Unable to load DLL 'MyDLL': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

    Problem : my windows docker container (build from windowsservercore base image) has one C# .net core service running .. on the specific POST request.. I need to call function from native C++ DLL, I am calling it using pInvoke. now the problem is the native DLL is not loading because some of its dependencies are missing in the container image.. I tried installing possible VC++ redistributables .. but it does not solve the problem.. so while checking complete dependency tree (using dependency walker) I came to know that some system libs are missing in the windowsservercore base docker image.

    following is the list of some of missing libs form docker container.

    c:\windows\system32\ELSCORE.DLL
    c:\windows\system32\DEVMGR.DLL
    c:\windows\system32\DCOMP.DLL
    c:\windows\system32\DSREG.DLL
    c:\windows\system32\SHDOCVW.DLL
    c:\windows\system32\COREUICOMPONENTS.DLL
    c:\windows\system32\POLICYMANAGER.DLL
    c:\windows\system32\OPENGL32.DLL

    So my question is, How to solve those system level lib dependencies on container ? I understand that for obvious reasons (minimizing the image size) those libs are excluded from the base windowsservercore docker image. But is there any standard way/installer/package that should include those to my docker image ? or should I go with dirty manually copy all the required libs to system32 folder 


    PS : This same code works on host machine (windows server 2016) after installing VC++ redistributable, its just that its not working on windowsservercore Docker container (even after installation of mentioned VC++ redistributable).

    Thanks,

    -Harsh


    Wednesday, July 4, 2018 12:22 PM

All replies

  • Greetings,

    Sorry for the delay response. You may have to add missing DLLs to images.

    You can use tools to find dependencies.

    Stefan wrote a nice blog post to share the detail steps.

    https://stefanscherer.github.io/find-dependencies-in-windows-containers/

    Related forum thread:

    https://social.msdn.microsoft.com/Forums/en-US/d09a2823-8f0e-44c9-8638-5b2c309ac818/docker-unable-to-use-native-dll-with-aspnet-web-application?forum=windowscontainers


    Sic Parvis Magna

    Sunday, July 8, 2018 7:27 AM