System.BadImageFormatException

Possible Solutions :

1. This Exception generally occurs if you are using Reflection and you are using Assembly.LoadFrom(“#SOMETHING HERE”). Now Assembly.LoadFrom will take a value of a dll. Kindly check if you are providing dll name instead of class name or something like below

ext = Assembly.LoadFrom(@"C:\Users\Aditya\Documents\Visual Studio 2012\Projects\adityaswamiblog\Reflections\ReflectionExample\ClassCar\bin\Debug\ClassCar.dll");

2. In the Properties of your Project. Change the Build -> Platform Target to ANYCPU

3. If you are referring multiple dll’s , kindly check the version of both are same.

Leave a comment