Nurzhan Aitbayev
Nurzhan Aitbayev

Reputation: 807

Errors after installation Breeze framework on ASP.NET Web Api Project

I have ASP.NET Web Api 2.2 project. I installed breeze via nuget on this project:

breeze-via-nuget

After installation Breeze framework I got errors and now I'm not able to build the project:

  1. Error Assembly 'System.Web.Http.OData, Version=5.2.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' uses 'System.Web.Http, Version=5.2.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' which has a higher version than referenced assembly 'System.Web.Http, Version=5.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' c:\Users\Home\Documents\Visual Studio 2013\Projects\MyProject\packages\Microsoft.AspNet.WebApi.OData.5.2.2\lib\net45\System.Web.Http.OData.dll

  2. Error - Assembly 'System.Web.Http.OData, Version=5.2.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' uses 'System.Net.Http.Formatting, Version=5.2.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' which has a higher version than referenced assembly 'System.Net.Http.Formatting, Version=5.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' c:\Users\Home\Documents\Visual Studio 2013\Projects\MyProject\packages\Microsoft.AspNet.WebApi.OData.5.2.2\lib\net45\System.Web.Http.OData.dll

Although libraries are new version.

When I open "References" of my project in "Solution explorer" and double click on "System.Web.Http"

references

It opens "Object Browser" tab. And there I have a few versions of "System.Web.Http". H

few versions

ow can I say to use version I need? How do I fix the problem?

Upvotes: 1

Views: 3786

Answers (3)

Andrey A.
Andrey A.

Reputation: 36

Solution of this issue is very simple. You need to delete a reference to the library from the project. Then check it was deleted in a bin folder. If not, delete it manually. Then add new reference to the required version of the library.

For some reasons VS doesn't replace a library when you reference to another version of the same library.

Upvotes: 2

Ward
Ward

Reputation: 17863

@KrishnaTejaVeeramachaneni - you gave him assembly redirects for everything EXCEPT the assembly identified in the message: System.Web.Http.OData!

Add this to the mix:

  <dependentAssembly>
    <assemblyIdentity name="System.Web.Http.OData" publicKeyToken="31bf3856ad364e35" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-5.2.0.0" newVersion="5.2.0.0" />
  </dependentAssembly>

I've got a ton of these redirects in my apps. Here's the entire section from DocCode's Web.config:

<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Http.OData" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-5.2.0.0" newVersion="5.2.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
          <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
          <bindingRedirect oldVersion="0.0.0.0-4.5.0.0" newVersion="4.5.0.0" />
      </dependentAssembly>
      <dependentAssembly>
          <assemblyIdentity name="System.Web.Http.OData" publicKeyToken="31bf3856ad364e35" culture="neutral" />
          <bindingRedirect oldVersion="0.0.0.0-5.2.0.0" newVersion="5.2.0.0" />
      </dependentAssembly>
      <dependentAssembly>
          <assemblyIdentity name="Microsoft.Data.Edm" publicKeyToken="31bf3856ad364e35" culture="neutral" />
          <bindingRedirect oldVersion="0.0.0.0-5.6.2.0" newVersion="5.6.2.0" />
      </dependentAssembly>
      <dependentAssembly>
          <assemblyIdentity name="Microsoft.Data.OData" publicKeyToken="31bf3856ad364e35" culture="neutral" />
          <bindingRedirect oldVersion="0.0.0.0-5.6.2.0" newVersion="5.6.2.0" />
      </dependentAssembly>
      <dependentAssembly>
          <assemblyIdentity name="System.Spatial" publicKeyToken="31bf3856ad364e35" culture="neutral" />
          <bindingRedirect oldVersion="0.0.0.0-5.6.2.0" newVersion="5.6.2.0" />
      </dependentAssembly>
    </assemblyBinding>
</runtime>

Upvotes: 0

Krishna Veeramachaneni
Krishna Veeramachaneni

Reputation: 2141

You will have to update the following settings in your web.config to something like this. Seems like when you installed the nuget packages, the default web.config settings were not updated correctly.

  <dependentAssembly>
    <assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-5.2.2.0" newVersion="5.2.2.0" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-5.2.2.0" newVersion="5.2.2.0" />
  </dependentAssembly>

Upvotes: 1

Related Questions