Rajnikant
Rajnikant

Reputation: 2234

Assembly Reference - System.BadImageFormatException error

I am referencing to an assembly built on .net 2.0 in .net 3.5 project. Its working fine on Windows xp machine, but when deploying on Win2003 64 bit

I am getting error below

System.BadImageFormatException: Could not load file or assembly 'Wrapper, Version=5.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.

WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

Project is built on Win xp 32 bit machine and then deployed using wix installer, Tried manually replacing assembly but didn't work.

Upvotes: 1

Views: 342

Answers (1)

Jon Skeet
Jon Skeet

Reputation: 1503839

You should check the build properties of the Wrapper assembly. I suspect it's set to 32-bit (x86). You'll need it to either be AnyCpu or x64 in order to be loaded into a 64-bit CLR.

Now if it's actually a wrapper for unmanaged code, you probably want two different versions of the assembly - one for 32-bit and one for 64-bit.

Another alternative is to change your application to be 32-bit. It's not clear what kind of application you're running, or whether that would be suitable - but it's worth considering.

Upvotes: 2

Related Questions