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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.