我有使用CDO ActiveX的.NET项目。 Everyhting在Windows Server 2003上运行正常但是当我将项目移动到Windows 2008时,我得到以下错误。这是因为CDO在Windows 2008上不可用吗?这怎么可以解决?
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)
答案 0 :(得分:3)
当64位程序集尝试加载32位程序集时,会发生此System.BadImageFormatException
(反之亦然)。我猜你从2003年开始 - > 2008年还涉及建筑的变革。确保您的项目与引用的程序集的构建目标匹配,或尝试构建为AnyCPU
答案 1 :(得分:0)
从32位win xp环境切换到Windows 7 64位时,我遇到了同样的问题。我想为其他任何有类似问题的人提供我的解决方案,花了几个小时才算出来。
我读过我需要切换我的Active Solution Platform以在x86模式下构建,但这并没有解决问题。事实证明我可以将我的平台留在任何CPU和我的应用程序池中,在高级设置下确保.net框架是正确的(在我的情况下我必须将它从4.0切换到2.0)并且我必须打开“启用32位应用程序“设置为false。