CJ7
CJ7

Reputation: 23275

BadImageFormatException when targeting 'AnyCPU' on 64-bit machine

When I transfer my source on to a Win7 64-bit machine I get a BadImageFormatException when I try to compile and run the solution targetting AnyCPU.

This does not happen on XP 32-bit.

What is the problem?

Upvotes: 0

Views: 1635

Answers (1)

purvin
purvin

Reputation: 144

It can typically occur when you changed the target framework of .csproj and reverted it back to what you started with.

Make sure 1 if supportedRuntime version="a different runtime from cs project target" under startup tag in app.config.

Make sure 2 That also means checking other autogenerated or other files in may be properties folder to see if there is no more runtime mismatch between these files and one that is defined in .csproj file.

These might just save you lot of time before you start trying different things with project properties to overcome the error.

Upvotes: 1

Related Questions