gpt4 book ai didi

c# - WCF 服务库 : BadImageFormatException with 32 bit dll

转载 作者:行者123 更新时间:2023-12-02 05:25:39 24 4
gpt4 key购买 nike

我的项目结构是这样的:

 myApp 
-->WCFSerLib (Any CPU Deafult application)
-->ClassLib1 (Any CPU)
-->ClassLib2 (x86)

当我尝试执行我的应用程序时,不幸遇到以下错误。

 System.BadImageFormatException was unhandled by user code

有什么办法可以达到上述目的吗?

谢谢

最佳答案

如果我猜对了,那么您正在尝试在 x64 机器上使用 x86 dll。使用 AnyCPU,.net 框架将自动使用当前架构。

因此您的应用程序作为 x64 应用程序运行,它试图加载失败的 x86 库。所以你有两个选择:

  • 将目标架构设置为 x86
  • 添加/创建 x64 库

如果您在环境变量中的某处有两个版本 (x86/x64),操作系统将自动选择正确的版本。

关于c# - WCF 服务库 : BadImageFormatException with 32 bit dll,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13120433/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com