0121 31 45 374
Qoute Icon

Could not load file or assembly xxx or one of its dependencies

Tim

We hit the fairly common issue of not being able to resolve a dependency the other day and tried all the usual resolutions -checking that the version numbers across all projects match, check the values in the configs haven't corrupted during an install, clean and rebuild the solution, updated/reinstalled the nuget packages and nothing worked, we just kept hitting

Could not load file or assembly 'Autofac, Version=3.5.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

The fix was ridiculously simple, in short, one of the app.configs had some out of date dependencies in the redirects -in this instance pointing at a newer version of Autofac from a failed upgrade so the fix was simply to correct the mappings. I didn't know that the app.config would affect the compiled assembly but it must overwrite the referenced DLL as the referenced versions were correct

So in summary, the references were changed from:

<dependentAssembly> <assemblyIdentity name="Autofac" publicKeyToken="17863af14b0044da" culture="neutral"/> <bindingRedirect oldVersion="0.0.0.0-3.5.0.0" newVersion="3.5.0.0"/> </dependentAssembly>

To this:

<dependentAssembly> <assemblyIdentity name="Autofac" publicKeyToken="17863af14b0044da" culture="neutral"/> <bindingRedirect oldVersion="0.0.0.0-2.6.3.862" newVersion="2.6.3.862" /> </dependentAssembly>

Liked this post? Got a suggestion? Leave a comment