I created a managed VC++ class library, and now I created a new C# console application. I added the DLL from the class library as a reference. Now, when I try to run my program from VS, VS complains that it cannot find the DLL. When I check the output folder bin\Debug
, however, the DLL is there.
Is there anything I forgot to configure?
The correct answer was in Hans passant's comment: The DLL which could not be loaded referenced another DLL which was not present in the output directory. That's why I got the exception.
I now added a post-build step which copies the DLL to the output directory after a successful build, and voilĂ , it works.