rabejens
rabejens

Reputation: 8122

Referenced DLL is not found when running application from VS

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?

Upvotes: 1

Views: 43

Answers (1)

rabejens
rabejens

Reputation: 8122

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.

Upvotes: 1

Related Questions