Search code examples
c#windowswindows-server-2008cdo.message

Could not load file or assembly CDO


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)

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