4

My Azure web project just started exhibiting an assembly binding error - Microsoft.Data.Edm v5.6.2.0 can't be found.

My project references that version of the assembly from a nuget package.

What I've discovered is this:

  • when I build the project, the bin\ folder contains the correct version of the assembly.
  • when I deploy the project to the Azure emulator, the assembly in bin\ is overwritten with an older version: v5.6.0.0.

The older version is not referenced by any of the projects in my solution, but it IS referenced by Microsoft.WindowsAzure.Storage v4.2.1.0, which in turn is referenced by my project.

(In fact, the Storage assembly references older versions of three assemblies that my project also references: Microsoft.Data.Edm, Microsoft.Data.OData, and Microsoft.Data.Services.Client - all three newer assemblies are overwritten with older assemblies on deploy.)

This behavior occured out of the blue: I was iterating on some maintenance, hit Ctrl+F5 for the 20th time this afternoon, and suddenly saw the error.

  • the newer version is overwritten in the web project's bin\ folder, but is not overwritten in the [azure project]\csx\Debug\roles\[web project name]\approot\bin or the [azure project]\obj\Debug\[web project name]\bin folders
  • the affected references are set to copy local
  • a diff of the project file shows no changes since last commit
  • an Azure worker role in the same solution has the same set of references but is unaffected
  • neither restarting VS nor rebooting has fixed the problem

Is there a way to beat Visual Studio back in line?

Ben M
  • 22,262
  • 3
  • 67
  • 71

1 Answers1

3

Welcome to crazy town:

  1. Note the timestamps of the older assemblies that are overwriting the newer ones
  2. c:\> dir /s microsoft.data.edm.dll
  3. Discover that, out of ~20 copies, the timestamps match files in C:\Program Files (x86)\Microsoft WCF Data Services\5.6\bin\.NETFramework - which I have never used
  4. Delete those copies and rebuild
  5. See that two of the three references are no longer overwritten on deploy, but Microsoft.Data.Services.Client.dll still is! - but from a source file with yet another timestamp
  6. Find the source of that file: it's in C:\Program Files\Microsoft SDKs\Windows Azure\.NET SDK\v2.3\ref
  7. Delete that, and rebuild - no more overwrites! Problem solved!

I only wish I knew why...

Ben M
  • 22,262
  • 3
  • 67
  • 71
  • I'm seeing the exact same problem / solution. There must be a build target some place that was very, very poorly written. – RMD Dec 01 '14 at 22:55
  • I'll also add that in my case, I had multiple SDK versions for both Azure and the WCF libs, and I had to kill them all. – RMD Dec 04 '14 at 21:32