.NET Framework: Could not load file or assembly error when running Console App

Viewed 24

I am working with Visual Studio 2019 on Windows 10. I have a Solution which has multiple Class Library Projects (all .NET Framework).

I have a 3rd party DLL which I have to use in one of my Class Library Project. So I include that DLL as Reference to my Class Library Project. And I am able to successfully use that DLL in couple of methods. So far so good.

Now I create a Console app Project (.NET Framework) in my Solution where I am calling methods in that Class Library Project. I set the Console app Project as startup Project and the build is successful. Now when I run it and call the Class Library Project's method which uses that 3rd party DLL, I get the error for the 3rd party DLL:

{"Could not load file or assembly 'ABCD, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format."}

Why I am getting this error when the 3rd party DLL is already successfully used in Class Library Project?

I did a clean build and rebuild and I can see that Visual Studio copied the 3rd party DLL in the bin\debug folder of Console app Project. So everything looks good. But still getting error. Confused. Please help.

0 Answers
Related