Unable to load build problem

I get the following error:

Unable to load assembly. Error Details: System.BadImageFormatException: Failed to load file or assembly file: ... or one of its dependencies. This assembly is built using a runtime that is newer than the currently loaded runtime and cannot be loaded.

This assembly was built with .Net Framework 4.0, and I made sure that all the projects in my solution are also built with .Net Framework 4.0.

Any idea why I get the error? How can I check which frameworks are loaded into my application?

+4
source share
2 answers

What is the main executable, i.e. assembly responsible for deciding which version of the CLR is loaded? Note that this is not just the case when it is created by .NET 4 — if your executable is aimed at .NET 3.5 or lower, it will load into the .NET 2.0 CLR, and your .NET 4 assemblies will not load.

+3
source

Hello, I had the same problem until I follow these tips: class BadImageFormatException (section "Notes")

In my case, I tried to load assemblies with a call to clever code.

0
source

All Articles