我有两个项目,ProjectA和ProjectB. ProjectB是一个控制台应用程序,依赖于ProjectA.昨天,一切都运转良好,但今天突然我跑了,ProjectB我得到了这个:
BadImageFormatException未处理:
无法加载文件或程序集"ProjectA,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = null"或其依赖项之一.尝试加载格式不正确的程序.
两者都只是常规项目,不依赖于任何其他非.Net项目.两者都是.Net - 没有本机代码,也没有P/Invoke.我有其他项目依赖ProjectA并仍然工作得很好.
我尝试过的事情:
但我仍然得到同样的错误.我不知道我做了什么导致这个,也不知道如何解决它.有任何想法吗?
我有一个使用Visual Studio 2010用C#编写的Windows服务,目标是完整的.NET Framework 4.当我从Debug构建运行时,服务按预期运行.但是,当我从Release版本运行它时,我得到一个System.BadImageFormatException(详情如下).我一直在网上寻找解决方案,但到目前为止,我发现的每件事都没有帮助我找到解决方案.
Windows 7 64位(dev)和Windows XP SP3 32位(目标)系统都存在此问题.
这是我到目前为止所尝试的:
所有这些检查都没有改变任何东西.我已经在下面列出了例外信息的全文,其中一些名称已经更改,以保护我公司主人的秘密.
System.BadImageFormatException was unhandled Message=Could not load file or assembly 'XxxDevices, 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. Source=XxxDevicesService FileName=XxxDevices, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null FusionLog=Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll Running under executable c:\Dev\TeamE\bin\Release\XxxDevicesService.vshost.exe --- A detailed error log follows. === Pre-bind state information === LOG: User = XXX LOG: DisplayName …