When a PARTIAL resolve is applied, the ASSEMBLY NAME must match the filename. However the LOCATION of the file can be different.
Otherwise the Fusion Binding Log will report "WRN: Comparing the assembly name resulted in the mismatch: NAME" and be unable to bind.
(Good news: it is possible to rename the assembly DLL to match the Assembly Name.)
For example:
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="6.0.0.0" />
<bindingRedirect oldVersion="11.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
<codeBase version="12.0.0.0" href="bin/Newtonsoft.Json.12/Newtonsoft.Json.dll" />
</dependentAssembly>
This resolves bin/Newtonsoft.Json.dll
and bin/Newtonsoft.Json.12/Newtonsoft.Json.dll
, depending on version (6-10 or 11-12, respectively). The NAME successfully matches the filename even though the directory path is different.
N.B. "bin" is itself part of the href to the alternate version; adjust as relevant depending on the application base, which is different than the probe path. In the case about, which is running under IIS, the app base is a level above the bin directoy. (See "LOG: Appbase = .." in the Fusion Log.)
Unfortunately the MSBuild process does not honor the directory structure of Referenced Assemblies automatically, regardless of any configuration files. Set the project to not "Copy Local" the alternative assembly versions and then copy them as part of a secondary process ensuring the correct structure is maintained. If any compiled assembly take the alternate version as a directly reference it might be good to ensure that none are "Copy Local" by default.