首页 > 代码库 > Could not load file or assembly ‘xxx’ or one of its dependencies. The located assembly's manifest definition does not match the assembly reference.

Could not load file or assembly ‘xxx’ or one of its dependencies. The located assembly's manifest definition does not match the assembly reference.

在写aspx web application时,我们有时会遇到这个问题。很多情况都是由于在线安装的Package引起的。系统尝试去找某一个version的dll,但是你却更新了最新的Package,造成不兼容。

解决办法就是检查web.config里如下类似的代码,并手动指定version,并安装或加载你想要version的dll即可。

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">      <dependentAssembly>        <assemblyIdentity name="Microsoft.IdentityModel.Clients.ActiveDirectory" publicKeyToken="31bf3856ad364e35" culture="neutral" />        <bindingRedirect oldVersion="0.0.0.0-2.11.0.0" newVersion="2.2.0.0" />      </dependentAssembly>    </assemblyBinding>

上面这个例子手动指定我想要系统加载Version为2.2.0.0的dll,在Reference里添加时注意也要添加相同版本的dll。

Could not load file or assembly ‘xxx’ or one of its dependencies. The located assembly's manifest definition does not match the assembly reference.