System.Net.Http.Formatting.FormUrlEn codedMediaTypeFormatter错误 [英] System.Net.Http.Formatting.FormUrlEncodedMediaTypeFormatter Error

查看:470
本文介绍了System.Net.Http.Formatting.FormUrlEn codedMediaTypeFormatter错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想MVC中4升级我的asp.net项目,以5我folloed这说明:<一href="http://www.asp.net/mvc/tutorials/mvc-5/how-to-upgrade-an-aspnet-mvc-4-and-web-api-project-to-aspnet-mvc-5-and-web-api-2" rel="nofollow">http://www.asp.net/mvc/tutorials/mvc-5/how-to-upgrade-an-aspnet-mvc-4-and-web-api-project-to-aspnet-mvc-5-and-web-api-2
当我想要编译我的项目,我收到以下错误:

I am trying to upgrade my asp.net project from Mvc 4 to 5. I folloed this instructions : http://www.asp.net/mvc/tutorials/mvc-5/how-to-upgrade-an-aspnet-mvc-4-and-web-api-project-to-aspnet-mvc-5-and-web-api-2
When I want to compile my project I am getting following error :

未能加载类型'System.Net.Http.Formatting.FormUrlEn codedMediaTypeFormatter从程序集System.Net.Http.Formatting,版本= 5.2.0.0,文化=中性公钥= 31bf3856ad364e35

Could not load type 'System.Net.Http.Formatting.FormUrlEncodedMediaTypeFormatter' from assembly 'System.Net.Http.Formatting, Version=5.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

如果我添加引用System.Net.Http.Formatting版本= 4.0.0.0那么我gettinrg此错误:

If I add the reference "System.Net.Http.Formatting Version=4.0.0.0" then I am gettinrg this error :

大会System.Web.Http,版本= 5.2.0.0,文化=中性公钥= 31bf3856ad364e35'用途'System.Net.Http.Formatting,版本= 5.2.0.0,文化=中性公钥= 31bf3856ad364e35,这具有更高版本比引用的程序集System.Net.Http.Formatting,版本= 4.0.0.0,文化=中性公钥= 31bf3856ad364e35

Assembly 'System.Web.Http, Version=5.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' uses 'System.Net.Http.Formatting, Version=5.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' which has a higher version than referenced assembly 'System.Net.Http.Formatting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

谁能帮我?

推荐答案

我presume您的问题(这@Adriano显然没有推断)的潜部分是,你的不看在当你去添加引用列表5.2.0.0版本中,你看到的只是4.0.0.0版本,对吧?

I presume the unspoken part of your question (which @Adriano clearly did not infer) is that you don't see version 5.2.0.0 in the list when you go to add a reference, you see only version 4.0.0.0, right?

如果是这样,这个问题可能是你的NuGet包,这意味着你有你需要升级的其他程序包。在我的情况下,它是 Microsoft.AspNet.WebApi.Client (显然 System.Net.Http.Formatting 是该装配...?!),将其升级在一个在我的解决方案的项目,但不包括其它。对你来说,它看起来像你也许需要安装特定的软件包的升级,和/或当您升级其他MVC包就被错过了。

If so, the issue is probably your NuGet packages, which means you have an additional package you need to upgrade. In my case it was Microsoft.AspNet.WebApi.Client (apparently System.Net.Http.Formatting is in that assembly…?!?), which was upgraded in one of the projects in my solution but not the other. In your case, it looks like perhaps you need to install the upgrade of that particular package, and/or it was missed when you upgraded the other MVC packages.

这篇关于System.Net.Http.Formatting.FormUrlEn codedMediaTypeFormatter错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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