BadImageFormatException

Feb 23, 2011 at 7:10 PM

After updating to the Feb 12 2011 beta release and rebuilding DotSpatial.Data.Database and DotSpatial.Data.Database.SpatiaLite2 one of my applications generates this error at runtime:

"Could not load file or assembly 'DotSpatial.Controls, Version=1.0.2011.2, Culture=neutral, PublicKeyToken=4d9e49339a7d240c' or one of its dependencies. An attempt was made to load a program with an incorrect format."

Does anyone know what I'm doing wrong?

Thanks

Developer
Feb 25, 2011 at 4:39 AM

This error looks like the "target .NET framework" or the target platform (x86 or x64) doesn't match. The feb 12 beta release has two packages: "x86 framework 4.0" and "x64 framework 4.0".

If you downloaded "x86 framework 4.0", then you need to rebuild DotSpatial.Data.Database, DotSpatial.Data.Database.SpatiaLite2 and your application with "x86" target platform.

If you downloaded "x64 framework 4.0", then the target platform of DotSpatial.Data.Database, DotSpatial.Data.Database.SpatiaLite2 and your applications must be "any CPU".

Also make sure, that you set target .NET framework to 4.0 and that you don't have any of the old DotSpatial libraries in any subfolder of your application.

Hope this helps,

Jiri