President Camacho
President Camacho

Reputation: 1910

Could not load file or assembly System.Runtime.CompilerServices.Unsafe on a clean autofac.mv5 installation

I just installed autofac.Mvc5 6.0 on my .net framework 4.7.2 installation.

And without adding any code other than adding the nuget package I get this error:

Could not load file or assembly System.Runtime.CompilerServices.Unsafe, Version=4.0.6.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a or one of it's dependences. The found Assembly's manifest definition does not match the Assembly reference. (Exception from HRESULT: 0x80131040)

Anyone got any idea?

Upvotes: 1

Views: 6409

Answers (1)

iamdlm
iamdlm

Reputation: 1973

You probably have another library that uses a different version of System.Runtime.CompilerServices.Unsafe. What's in web.config?
Did you tried bindingRedirect?

<dependentAssembly>
    <assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-4.0.6.0" newVersion="4.0.6.0" />
</dependentAssembly>

If you have a newer version replace it in the newVersion above.

Upvotes: 3

Related Questions