Loading an Assembly fails because of incorrect format

↘锁芯ラ 提交于 2020-01-02 05:41:13

问题


I develop on a pretty big windows forms .net (C#) application with several assemblys. Originally each assembly was build for the Target Platfom "Any CPU". Due to a problem with Crystal Reports on x64 machines we had to build the whole project for x86 target platform. I startet rebuilding some of our Projects for x86 and it worked just fine. But with one I have the problem that when I try to use it as a reference in another Assembly, the other one won't load it giving following Error:

Could not load file or assembly #MyAssembly# or one of its dependencies. An attempt was made to load a program with an incorrect format.

When playing Around with Crystal in a sample project with more than one assembly I found out that this error occurs when the Projects are build for different target platforms. But this isn't the case here. I build every Project for X86 and just can't figure out where the problem is here.


回答1:


You can try, to build your MainProject (Executable) with target platform "x86" or "x64", an all other projects you set to "Any CPU".



来源:https://stackoverflow.com/questions/4049517/loading-an-assembly-fails-because-of-incorrect-format

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!