0

I have a WinForms project that references to some library. In main() of that project I added

AppDomain.CurrentDomain.AssemblyResolve += MyResolveEventHandler;

but it catches only libraries that are called by the executable itself (this project). However this library that the project is referencing to is calling another library (via DllImport) and this "imported library" tries to find some libraries (can't say how as this imported library is unmanaged) but it can't locate them in PATH. I would like to give it an assembly path, but, as said above, the main() doesn't catch this event. How can I make it do?

Mike
  • 842
  • 1
  • 9
  • 31
  • 2
    AssemblyResolve is for managed assemblies. Unmanaged code would probably use [LoadLibrary](https://msdn.microsoft.com/en-us/library/windows/desktop/ms684175%28v=vs.85%29.aspx) which has its own search paths which can be modified with [SetDllDirectory](https://msdn.microsoft.com/en-us/library/windows/desktop/ms686203(v=vs.85).aspx). – Mike Zboray Apr 27 '15 at 03:54
  • You can mark it as an answer, I took the code from https://social.msdn.microsoft.com/Forums/vstudio/en-US/cbbf2d61-6824-4b2f-90ea-bce3291c7fc8/what-else-in-order-to-make-setdlldirectory-work-in-a-net-40-app?forum=clr – Mike Apr 27 '15 at 04:31

0 Answers0