System.IO.FileLoadException on builder.Build()
After upgrading to Web Api 2.2 I get the following issue on calling IContainer container = builder.Build();
An exception of type 'System.IO.FileLoadException' occurred in Autofac.dll but was not handled in user code
Additional information: Could not load file or assembly 'Autofac.Integration.WebApi, Version=3.0.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)
I am using Autofac.WebApi2 3.4.0 System.Web.Http 5.2.2.0
Add a binding redirect to your web.config to redirect requests for version 3.0.0.0 to 3.4.0.0. Sometimes NuGet forgets to add it for you.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Autofac.Integration.WebApi"
publicKeyToken="17863af14b0044da"
culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.4.0.0"
newVersion="3.4.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
Just the ticket. Thanks!
Sent from my iPhone
On 17 Oct 2014, at 23:07, Travis Illig [email protected] wrote:
Add a binding redirect to your web.config to redirect requests for version 3.0.0.0 to 3.4.0.0. Sometimes NuGet forgets to add it for you.