Monday, June 16, 2014

Step by step how to fix the error "Could not load file or assembly 'Microsoft.Data.Services, Version=5.0.0.0'"

       By Carmel Shvartzman

In this tutorial we'll learn how to fix the error "Could not load file or assembly 'Microsoft.Data.Services, Version=5.0.0.0'" in an Asp.Net MVC application
This error is thrown in case of a reference in your application, that points to the 5.0.0.0 version of the Microsoft.Data.Services assembly.
The error appears as this : 

  First i thought that the problem was in the web.config:
<dependentAssembly>
<assemblyIdentity name="Microsoft.Data.Services" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-5.0.0.0" newVersion="5.0.2.0" />
</dependentAssembly>

But as can be seen, there was explicitly stated to use the version 5.2.0.0 of the assembly.
Then i remembered that at the creation of the data Service, there is a definition  of the version of the   Microsoft.Data.Services  assembly to be loaded:






Just change the version to the one you need : 5.2.0.0, & that's all!!


Happy programming.....


כתב: כרמל שוורצמן