1

I am trying to solve an issue where I have a class library that uses a dll(say A) and in turn, that dll(A) uses a 64 bit native dll. I am referencing the class library in asp.net core web api application in visual studio. When I call a function from class library that uses the native dll, it throws me error:

DllNotFoundException: Unable to load DLL 'company.Native.dll' or one of its dependencies: The specified module could not be found. (Exception from HRESULT: 0x8007007E)

When I create a .net core console app and refer the same class library and call the same function, it works fine.

So I am trying to find what's there in console app that I am not doing in asp.net core application?

or something in asp.net core that is preventing loading of that native dll.

I looked at the bin/debug in asp.net core application and I can see the native dll there. Also the dll and the native dll that it refers are in same folder.

NetDeveloper
  • 509
  • 1
  • 9
  • 20
  • 1
    I'm guessing you checked out [this question](https://stackoverflow.com/questions/9003072/unable-to-load-dll-module-could-not-be-found-hresult-0x8007007e/25685000) and it didn't help you out? – KevinLamb Jun 25 '19 at 17:14
  • Hi Kevin, Thank you for the link. I will go through all of them. I would like to mention that the native dll in not something I am directly using. I have a dll that calls that native dll. – NetDeveloper Jun 25 '19 at 17:24
  • @KevinLamb that did not help me as in my case the native dll in not something I am directly using. I have a dll that calls that native dll. also I am having problem only in asp.net core web api application. BUt looking at other places on internet, I think native dlls cannot execute on non-windows machines so that is why asp.net core is not loading it ? – NetDeveloper Jun 25 '19 at 19:43
  • 1
    Is it the same box? Otherwise maybe you miss some native dependency you have on the devlopment box... – Felice Pollano Jun 26 '19 at 14:55
  • hi @Felice Pollano, I hope I understand your question correctly and the native dll is in the bin/debug/netcoreapp2.2 folder. the same folder where all other dlls are. – NetDeveloper Jun 26 '19 at 17:39
  • hi Felice and Kevin, Earlier I said both dlls are in same folder but they were not. hence the issue. thank you for the help! – NetDeveloper Jun 26 '19 at 21:01

0 Answers0