I have an Asp.Net project (Vb.Net) that references a managed dll (library written in C#). That library project has several unmanaged dependencies dlls in a lib folder (copied into bin/Release/lib folder during build). The library is not a part of the main solution.
My library uses [DllImport] that references an unmanaged dll. But to let the unmanaged dll be found, I call SetDllDirectory():
string path = // don't know how to generate the path
SetDllDirectory(path);
I am struggling with generating the path to the unmanaged dll and its dependencies. I can start with my main project bin folder or something. But what should I do next? E.g. is there a way to copy the unmanaged dlls from the library's bin/Release/lib folder to my main project's bin folder? Or some other solution?