Tuesday, November 19, 2013

System.BadImageFormatException: Could not load file or assembly 'xxx.dll'or one of its dependencies. An attempt was made to load a program with an incorrect format.

If you encounter below error when running Visual Studio .NET but compilation is successful.
System.BadImageFormatException: Could not load file or assembly 'xxx.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format.

Resolution:
1) Ensure that all projects have the same .net framework version you can check this from each project properties.
2) Ensure that the target platform is Any CPU on solution properties and each project properties (for .NET it's under Compile section, for C# it's under Build section).

Reference: here

No comments: