Could not load Microsoft.Data.OData 5.2.0 because of updated version 5.6.0

15/12/2013

Many of Microsoft’s data centric APIs (WebAPI.OData, WindowsAzure.Storage, etc) rely on the Microsoft.Data.OData library (ODataLib) and its dependencies, Microsoft.Data.Edm, Microsoft.Data.OData, and System.Spatial. To install the ODataLib simply run “Install-Package Microsoft.Data.OData” in the package manager window. Unfortunately because of seperate release cycles of Microsofts libraries not all of their libraries rely on the latests version of the ODataLib, currently 5.6.0.

For instance the Microsoft.WindowsAzure.Storage library version 2.1.0.0, is currently dependent on version 5.2.0 of the ODataLib, while e.g. the Microsoft.AspNet.WebApi.OData 5.0.0 library relies on ODataLib 5.6.0. This may cause some headache if you like me try to use both in the same project, in my case it was an Azure Cloud Service project. To combat the issues of Microsoft.WindowsAzure.Storage library relying on the older version of the ODataLib, we have to restort to assemblybindring redirects.
In the web.config of the webrole and in the app.config of the worker role, simply add the following to force use of the newest version 5.6.0 so far I haven’t noticed any issues with compatability.