Question

I have .NET project which use CDO ActiveX. Everyhting works fine on Windows Server 2003 but when I move the project to Windows 2008 I get error below. Is this because CDO is not available on Windows 2008? How this could be solved?

Error: Could not load file or assembly 'Interop.CDO, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format., 
StackTrace    at MailBotConsole.ServiceClass.ProcessEmail(String email)
Was it helpful?

Solution

This System.BadImageFormatException occurs when a 64 bit assembly attempts to load a 32 bit assembly ( or vice versa ). I'd guess that your move from 2003 -> 2008 also involved a change in architecture. Make sure that your project matches the build target of the referenced assembly or try building as AnyCPU

OTHER TIPS

I had the same issue when switching from a 32bit win xp environment to a windows 7 64 bit. I wanted to provide my solution for anyone else that had a similar issue, spent hours before I figured this out.

I had read that I needed to switch my Active Solution Platform to build in x86 mode, but this didn't fix the problem. Turns out I could leave my platform to any CPU and in my application pool under advanced settings ensure the .net framework was correct (in my case I had to switch it from 4.0 to 2.0) and I had to turn on "enable 32-bit applications" which was set to false.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top