0

I am trying to add a managed dll "Emgucv.dll" and unmanaged dll "cvextern.dll"

I have both dlls in the lib\x64 directory

When I try to add a reference to the managed dll, using Browse, it automatically moves the dll to the root folder of my project. Then it is unable to find the cvextern.dll until I also move that to the root of y project and set it to copy if newer

However, I would like to keep both dlls in the lib\x64 directory

Is there a way to add the path to using Emgu.CV directive? Or to add a search folder to C# project configuration?

I tried adding to app.config

<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <probing privatePath="lib/x64" />
    </assemblyBinding>
</runtime>

But this made no difference

Mich
  • 3,188
  • 4
  • 37
  • 85

1 Answers1

0

<probing privatePath="lib/x64" /> is for .Net Framework and the folder lib must be the sub folder of output folder. You may need Assembly.LoadFrom Method.

  Assembly myAssembly = Assembly.LoadFrom("path/managed.dll");

Use P/Invoke to specify the path to load unmanaged dll.

 [DllImport("path/x64/Debug/unmanaged.dll")]

In addition, check How to add folder to assembly search path at runtime in .NET?

Minxin Yu - MSFT
  • 2,234
  • 1
  • 3
  • 14