Reputation: 130
I have a C++ DLL library (let's call it unmanaged.dll
) that gets wrapped around a managed .NET library (let's call it managed.dll
). The managed.dll
uses unmanaged.lib
to import/link unmanaged.dll
. I have another ASP.NET Web API project that uses managed.dll
(let's call the project webapi.dll
). Now, whenever I build the Web project, in the output directory I get webapi.dll
and managed.dll
. Then, I manually copy unmanaged.dll
to be in the same output folder so that (presumably) .NET can locate it and load it.
However, when I try to run webapi.dll
, it fails with an error that it cannot load managed.dll
:
Could not load file or assembly 'managed.DLL' or one of its dependencies. The specified module could not be found.
This is particularly weird because unmanaged.dll
is in the same folder.
What I find very weird is that if I put unmanaged.dll
under C:\Windows\system32
then .NET can properly load it!
My question is how can I make this unmanaged.dll
visible to .NET in the folder where the .NET project output is residing?
Upvotes: 1
Views: 681
Reputation: 1449
It's the IIS that is causing the problems. Had the same problem, sovled it by adding the dll to a folder, that lies in the PATH variable.
Upvotes: 2