什么原因的错误:我无法加载文件或程序集“”或一个依赖

什么原因的错误:我无法加载文件或程序集“”或一个依赖

问题描述:

我在Web项目我用VS2013.In解决方案的一个2个项目在溶液中的所有项目的构建平台的目标是Any CPU什么原因的错误:我无法加载文件或程序集“”或一个依赖

当我开始在Global.asax文件中的一些点上的解决方案,我得到这个错误:

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

虽然所有的DLL和依赖都在bin文件夹中。

如果在Visual Studio中检查工具 - >选项 - >项目和解决方案 - > Web项目 - >Use the 64 bit version of IIS中的选项,我不会收到任何错误。

我的问题是任何想法,为什么我得到上述错误?

+1

什么是MapGuideDotNetApi? –

+0

@YashveerSingh它是我使用的开源的dll。 – Michael

+0

您是否拥有该DLL的32位版本?我怀疑不是。 –

请检查你的web.config,它应该包含的组件runtime XML节点

<?xml version="1.0" encoding="utf-8"?> 
<!-- 
    For more information on how to configure your ASP.NET application, please visit 
    http://go.microsoft.com/fwlink/?LinkId=301880 
    --> 
<configuration> 
<!--whatever goes here--> 
<runtime> 
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> 
     <dependentAssembly> 
     <assemblyIdentity name="MapGuideDotNetApi" publicKeyToken="some token" /> 
     <bindingRedirect oldVersion="some old version" newVersion="some new version" /> 
     </dependentAssembly> 
     <!--other assemblies--> 
    </assemblyBinding> 
    <!--whatever--> 
</runtime> 
<!--whatever goes here--> 
</configuration> 

为了让大会出现在这里,我建议删除和添加的基准而被打破。

+0

当我添加阻止到webconfig我得到这个错误: 应用程序配置文件“Web.config文件”是无效的。 assemblyIdentity元素的某些属性不正确。 – Michael

+0

它应该当你添加参照项目 –

+0

MapGuideDotNetApi它的非托管的DLL被自动添加。 – Michael