System.Web.Http参考默认为4.0版本,无论我如何努力 [英] System.Web.Http reference defaults to 4.0 version no matter how i try

查看:781
本文介绍了System.Web.Http参考默认为4.0版本,无论我如何努力的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用我的项目BreezeApi的NuGet包。它是在Visual Studio 2013。

I am using BreezeApi nuget package in my project. It is in visual studio 2013.

我得到这个错误。

错误41大会Breeze.WebApi2,版本= 1.4.0.0,文化=中性公钥= f6085f1a45e2ac59'用途'的System.Web。 HTTP,版本5.0.0.0 =文化=中性公钥= 31bf3856ad364e35'具有更高的版本比引用的程序集System.Web.Http,版本= 4.0.0.0,文化=中性公钥= 31bf3856ad364e35

Error 41 Assembly 'Breeze.WebApi2, Version=1.4.0.0, Culture=neutral, PublicKeyToken=f6085f1a45e2ac59' uses 'System.Web.Http, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' which has a higher version than referenced assembly 'System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

我不知道为什么我的项目不断引用到4.0版本。结果
事情,我试过。

I dont know why my project keeps referencing to 4.0 version.
Things i tried.

1),我从我的项目中删除system.web.http 4.0的参考和浏览的5.0 dll的位置。只要我添加,回来Solution Explorer中,右键单击system.web.http DLL,它显示4.0.0.0

1) I removed the reference of system.web.http 4.0 from my project and browsed to 5.0 dll location. As soon as i add it and come back to solution explorer, right click on the system.web.http dll, it is shown 4.0.0.0

2)我加总成在web.config中像下面

2) I added assembly binding in web.config like below

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



能有人帮我解决这个?谢谢

Could some one help me resolve this? Thanks

推荐答案

这是我做过什么来解决你的差不多的一个问题:

This is what I did to solve an issue very similar to yours:

错误2大会'Breeze.WebApi2,版本= 1.4.0.0,文化=中立,
公钥= f6085f1a45e2ac59'用途'System.Web.Http,
版本= 5.1.0.0,文化=中性公钥= 31bf3856ad364e35'
具有更高版本比引用的程序集'System.Web.Http,
版本5.0.0.0 =文化=中立,
公钥= 31bf3856ad364e35'C:\Repos\SPACodeCamper\packages\Breeze.Server.WebApi2.1.4.12\lib\Breeze.WebApi2.dll CC.Web

Error 2 Assembly 'Breeze.WebApi2, Version=1.4.0.0, Culture=neutral, PublicKeyToken=f6085f1a45e2ac59' uses 'System.Web.Http, Version=5.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' which has a higher version than referenced assembly 'System.Web.Http, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' c:\Repos\SPACodeCamper\packages\Breeze.Server.WebApi2.1.4.12\lib\Breeze.WebApi2.dll CC.Web

我在做的过程中建设得到这个错误应用与角度和微风 - 第1部分通过约翰爸爸。事情发生在一步3.15添加微风的Web API控制器来CC.Web后。

I got this error while doing the course Building Apps with Angular and Breeze - Part 1 by John Papa. It happened on step 3.15 after adding the Breeze Web API Controller to CC.Web.

要解决这个问题,我们需要更新以下的NuGet包。我用的NuGet包管理器在Visual Studio 2013:

To solve it we need to update the following NuGet Packages. I used NuGet Package Manager in Visual Studio 2013:


  1. Microsoft.AspNet.WebApi.Client从5.0.0到5.1.2

  2. Microsoft.AspNet.WebApi.Core从5.0.0到5.1.2

  3. Microsoft.AspNet.WebApi.WebHost从5.0.0到5.1.2

  4. 从5.0.0 Microsoft.AspNet.WebApi.OData到5.1.2(这个我不得不重新启动Visual Studio以完成安装)

  1. Microsoft.AspNet.WebApi.Client from 5.0.0 to 5.1.2
  2. Microsoft.AspNet.WebApi.Core from 5.0.0 to 5.1.2
  3. Microsoft.AspNet.WebApi.WebHost from 5.0.0 to 5.1.2
  4. Microsoft.AspNet.WebApi.OData from 5.0.0 to 5.1.2 (this one I had to restart Visual Studio to complete the installation)

更新上面的NuGet包会照顾颠簸 System.Web.Http 的版本,以正确的,在这个案例 5.1.0.0

Updating the NuGet packages above will take care of bumping System.Web.Http's version to the correct one, in this case 5.1.0.0.

这篇关于System.Web.Http参考默认为4.0版本,无论我如何努力的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆