We are using the Windows Azure Storage NuGet package version 4.1.0, this has a dependency on Microsoft.Data.OData and has added that package as well which has the Microsoft.Data.Edm dll. When we build and run the application we very occasionally get the following error:
Could not load file or assembly 'Microsoft.Data.Edm' or one of its dependencies. The
located assembly's manifest definition does not match the assembly reference. (Exception
from HRESULT: 0x80131040)
We have the following binding redirect in the web.config and also have checked and this is the only version of Microsoft.Data.Edm being referenced by any projects in the solution.
<dependentAssembly>
<assemblyIdentity name="Microsoft.Data.Edm" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.6.1.0" newVersion="5.6.1.0" />
</dependentAssembly>
Sometimes when I look in the bin folder I find the dll version of Microsoft.Data.Edm is v 5.6.0. I have been through all the projects and I cannot find a reference to Microsoft.Data.Edm except with the storage client and that is definitely 5.6.1.
What is the best way to try and work out where the 5.6.0 version is coming from? When we do get this error we delete the bin and obj folders and rebuild and then it works fine, the 5.6.1 version is there and everything works but eventually it happens again.
EDIT:
We have upgraded again to all the latest versions from NuGet and still no luck, I ran a tool which shows the following dependencies:
Possible conflicts for Microsoft.Data.Edm:
Microsoft.Data.OData references Microsoft.Data.Edm, Version=5.6.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
Microsoft.Data.Services.Client references Microsoft.Data.Edm, Version=5.6.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
Microsoft.WindowsAzure.Storage references Microsoft.Data.Edm, Version=5.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
Possible conflicts for Microsoft.Data.OData:
Microsoft.Data.Services.Client references Microsoft.Data.OData, Version=5.6.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
Microsoft.WindowsAzure.Storage references Microsoft.Data.OData, Version=5.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
What I don't understand is we have the app binding redirects set but sometime the 2.6.0 version is copied in and sometimes the 2.6.2. Does anyone know why this would be happening, never had this problem before.
question from:
https://stackoverflow.com/questions/25175525/could-not-load-file-or-assembly-microsoft-data-edm 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…