Back

Explore Courses Blog Tutorials Interview Questions
0 votes
3 views
in Azure by (45.3k points)

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 sometimes 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.

1 Answer

0 votes
by (16.8k points)

One thing that sometimes seems to resolve this issue for members of my team is to close all instances of Visual Studio, delete the contents of the packages directory, re-open Visual Studio, and then restore packages and rebuild. This doesn't always work though.

We were able to trace the issue on one of our machines by identifying the problematic project by increasing the Visual Studio build output verbosity:

Increasing Visual Studio build output verbosity

Then, we searched the output and identified the target project that was problematic by searching for "Microsoft.Data.Edm". We noticed that it seemed to have an indirect dependency to Microsoft.Data.Edm, but we noticed that the assembly was not explicitly included as a package for that project. So, using the Nuget package console, we targeted the project and ran: Install-Package Microsoft.Data.Edm which resolved the issue.

Install Package with Nuget

Browse Categories

...