Failed to load the file or assembly "Common.Logging, Version=2.1.1.0, Culture=neutral, PublicKeyToken=af08829b84f0328e" or one of its dependencies. The found assembly manifest definition does not match the assembly reference. (Exception from HRESULT:0x80131040)
Description: An unhandled exception occurred during the execution of the current web request. Check the stack trace information for details about the error and where it came from in your code that caused the error.
Exception details: System.IO.FileLoadException: Failed to load file or assembly "Common.Logging, Version=2.1.1.0, Culture=neutral, PublicKeyToken=af08829b84f0328e" or one of its dependencies. The found assembly manifest definition does not match the assembly reference. (Exception from HRESULT:0x80131040)
Source error:
An unhandled exception was generated during the execution of the current web request. You can use the following exception stack trace information to determine the cause of the anomaly and where it occurred.
Assembly Load Trace: The following information can help determine why the assembly "Common.Logging, Version=2.1.1.0, Culture=neutral, PublicKeyToken=af08829b84f0328e" failed to load.
Sometimes, we see the above error.
Error cause
Project A references xxx.dll, Project B also references xxx.dll, and Project A refers to Project B, as shown in the figure below:
Both project A and project B refer to xxx.dll, but project A refers to a higher version of the dll, and project B refers to a lower version of the dll
Solution
<bindingRedirect>element, redirect one assembly version to another.
oldVersion
- Required properties
- Specifies the version of the assembly that was originally requested. The assembly version number is in the format of major.minor.build.revision. Each part of this version number has a valid value between 0 and 65535.
- You can also specify a version range in the following format:
- n.n.n.n-n.n.n.n
newVersion
- Required properties.
- Specifies the version of the assembly to use instead of the version format originally requested: n.n.n.n
- This value can specify a version prior to oldVersion.
Documentation link:https://docs.microsoft.com/zh-cn ... ingredirect-element
Official examples:
So, my workaround is to set it up like this in web.config:
|