Erik Sapir
Erik Sapir

Reputation: 24767

Cannot load assembly problem

I receive the following error:

Cannot load assembly. Error details: System.BadImageFormatException: Could not load file or assembly 'file:...' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.

This assembly is built with .Net Framework 4.0 and i made sure that all projects in my solution are also built with .Net Framework 4.0.

Any idea why i am getting the error? How can i check which frameworks are loaded with my application?

Upvotes: 4

Views: 3977

Answers (2)

Bruno
Bruno

Reputation: 1974

Hello I Had the same problem until i follow these hints: BadImageFormatException Class (section "Remarks")

In my case I was trying to load assemblies with call to umnaged code.

Upvotes: 0

Jon Skeet
Jon Skeet

Reputation: 1503140

What is the main executable, i.e. the assembly responsible for deciding which version of the CLR is loaded? Note that it's not just a case of being built by .NET 4 - if your executable targets .NET 3.5 or lower, it will load in the .NET 2.0 CLR, and your .NET 4 assemblies won't load.

Upvotes: 3

Related Questions