Could not load file or assembly 'Microsoft.Data.Edm' Could not load file or assembly 'Microsoft.Data.Edm' azure azure

Could not load file or assembly 'Microsoft.Data.Edm'


I had the same error message but my issue was unrelated to any Azure product. In my case, I updated OData from version 3 to 4 and it appears to me that Nuget left behind binding redirects for deprecated dll's. There were actually three in total, Microsoft.Data.Edm, Microsoft.Data.OData and System.Spatial.

My solution was to remove the deprecated binding redirects. You should also remove the old dll's sitting in your bin folder if your build process doesn't.


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.Edmwhich resolved the issue.

Install Package with Nuget


Here's few things you can try:

  1. Check your Post Build event to make sure no Microsoft.Data.Edm.dll file is being copied manually to bin folder.
  2. Make sure other packages don't have dependency to Microsoft.Data.Edm 5.6.1. Easy way to do this is by looking at your package.config files.
  3. If your code is in source control, make sure nobody check in bin folder. I am surprised by how many people don't know this basic rule.
  4. Uninstall WindowsAzure.Storage and Microsoft.Data.Edm packages. Then install again and make sure you only install the stable version.

HTH.