Microsoft.Data.OData Version mismatch for Breeze Server - for Web API 2
Asked Answered
G

2

5

Breeze Server - for Web API 2 version 1.4.8 in Nuget installs Microsoft.Data.OData Version=5.6.1, yet references version 5.6.0.

See error below:

Metadata query failed for: *; Could not load file or assembly 'Microsoft.Data.OData, Version=5.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Guffaw answered 20/3, 2014 at 10:22 Comment(0)
G
7

Make sure you correct the correct assembly versioning (web.config if a web project) as:

<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <dependentAssembly>
    <assemblyIdentity name="Microsoft.Data.OData" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="0.0.0.0-5.6.0.0" newVersion="5.6.1.0" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="Microsoft.Data.Edm" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="0.0.0.0-5.6.0.0" newVersion="5.6.1.0" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="System.Spatial" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="0.0.0.0-5.6.0.0" newVersion="5.6.1.0" />
  </dependentAssembly>
</assemblyBinding>

Then in your Data project's app.config file, comment out the <entityFramework> section:

<entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>

Then, if you don't already have it, add the following config section:

<configSections>
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>

Lastly, in your XxDbContext class, add/modify your static constructor as:

static XxDbContext()
{
   var type1 = typeof(System.Data.Entity.SqlServer.SqlProviderServices);
}

These steps fixed my issue. Good luck.

Grith answered 24/3, 2014 at 2:37 Comment(1)
Thanks. I'm sure that would work. What I did was uninstall Breeze Server - for Web API 2, installed the earlier version of OData (Install-Package microsoft.Data.OData -Version 5.6.0), then re-installed Breeze Server - for Web API 2.Guffaw
H
0

[Symptom] If you started having this issue without introducing new dependencies, it is likely that your temporary asp.net folder has lost integrity.

[Solution] Try deleting %LOCALAPPDATA%\Temp\Temporary ASP.NET Files\

Hecker answered 27/6, 2014 at 16:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.