I am working on Windows 7 with Visual Studio 2008.
I have a .NET assembly that calls calls to my native DLL with P / Invoke. I created a separate .NET unit test project in my Visual Studio solution, which tests the assembly by making various calls to it. However, when the unit test makes a call in the assembly, and the assembly makes the call using P / Invoke, it cannot find the native DLL.
When I write a standalone .NET console application, there is no problem. The assembly can use P / Invoke and successfully find the DLL.
I can make the unit test work by calling LoadLibrary with an absolute DLL path before using the assembly. However, this approach is ugly and requires an absolute path that will be problematic for other users.
In short, my question is: how can I specify or change the DLL search path that is used when running the Visual Studio unit test?
Any help would be greatly appreciated.
Regards, Dan
source
share