Skip to content

Instantly share code, notes, and snippets.

@thdotnet
Created June 10, 2015 14:03
Show Gist options
  • Save thdotnet/b389ad252552368f5171 to your computer and use it in GitHub Desktop.
Save thdotnet/b389ad252552368f5171 to your computer and use it in GitHub Desktop.
Could not load file or assembly Microsoft.Data.OData Version=5.2.0.0 error in Azure
Today I've faced a problem with Microsoft.WindowsAzure.Storage nuget package. Running the application I've got the following runtime exception:
"Could not load file or assembly Microsoft.Data.OData Version=5.2.0.0..."
I've found some blog posts that says to use binding redirect to Version 5.6.4.0. However, only configuring the binding redirect of this version will not fix the error, When I've published my application to Azure, I've saw a message on the output window:
1>------ Build started: Project: XXX, Configuration: Release Any CPU ------
1> Consider app.config remapping of assembly "Microsoft.Data.Edm, Culture=neutral, PublicKeyToken=31bf3856ad364e35" from Version "5.6.2.0" [] to Version "5.6.4.0" [C:\Users\br.thiago.custodio\documents\visual studio 2013\Projects\XXX\packages\Microsoft.Data.Edm.5.6.4\lib\net40\Microsoft.Data.Edm.dll] to solve conflict and get rid of warning.
1> Consider app.config remapping of assembly "Microsoft.Data.Services.Client, Culture=neutral, PublicKeyToken=31bf3856ad364e35" from Version "5.6.2.0" [] to Version "5.6.4.0" [C:\Users\br.thiago.custodio\documents\visual studio 2013\Projects\XXX\packages\Microsoft.Data.Services.Client.5.6.4\lib\net40\Microsoft.Data.Services.Client.dll] to solve conflict and get rid of warning.
1> Consider app.config remapping of assembly "Microsoft.Data.OData, Culture=neutral, PublicKeyToken=31bf3856ad364e35" from Version "5.6.2.0" [] to Version "5.6.4.0" [C:\Users\br.thiago.custodio\documents\visual studio 2013\Projects\XXX\packages\Microsoft.Data.OData.5.6.4\lib\net40\Microsoft.Data.OData.dll] to solve conflict and get rid of warning.
1> Consider app.config remapping of assembly "Newtonsoft.Json, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" from Version "4.5.0.0" [C:\Program Files (x86)\Microsoft Visual Studio 12.0\Blend\Newtonsoft.Json.dll] to Version "6.0.0.0" [C:\Users\br.thiago.custodio\documents\visual studio 2013\Projects\XXX\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll] to solve conflict and get rid of warning.
So, just add the binding redirects to web.config as the message says:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Data.OData" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="5.6.2.0" newVersion="5.6.4.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Data.Services.Client" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="5.6.2.0" newVersion="5.6.4.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Data.Edm" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="5.6.2.0" newVersion="5.6.4.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="4.5.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment