2

我用的NuGet安装“微软的ASP.NET Web API客户端库”以获取在Windows中使用的最新装配System.Net.Http Phone 7.1 XNA和Silverlight项目。它在我的WP7.1 XNA项目中安装得很好,但不允许我将它安装到WP7.1 Silverlight项目中。我甚至尝试直接从程序包管理器控制台将其安装到新创建的WP7.1 Silverlight项目,并得到了这个错误响应:无法安装System.Net.Http包到了Windows Phone 7.1的Silverlight项目

PM> Install-Package System.Net.Http 
Attempting to resolve dependency 'Microsoft.Net.Http (≥ 2.0.20710.0 && < 2.1)'. 
You are downloading Microsoft.Net.Http from Microsoft, the license agreement to which is available at http://www.microsoft.com/web/webpi/eula/MVC_4_eula_ENU.htm. Check the package for additional dependencies, which may come with their own license agreement(s). Your use of the package and dependencies constitutes your acceptance of their license agreements. If you do not accept the license agreement(s), then delete the relevant components from your device. 
Successfully installed 'Microsoft.Net.Http 2.0.20710.0'. 
You are downloading System.Net.Http from Microsoft, the license agreement to which is available at http://www.microsoft.com/web/webpi/eula/MVC_4_eula_ENU.htm. Check the package for additional dependencies, which may come with their own license agreement(s). Your use of the package and dependencies constitutes your acceptance of their license agreements. If you do not accept the license agreement(s), then delete the relevant components from your device. 
Successfully installed 'System.Net.Http 2.0.20710.0'. 
Successfully uninstalled 'Microsoft.Net.Http 2.0.20710.0'. 
Install failed. Rolling back... 
Install-Package : Could not install package 'Microsoft.Net.Http 2.0.20710.0'. You are trying to install this package into a project that targets 'Silverlight,Version=v4.0,Profile=WindowsPhone71', but the package does not contain any assembly references that are compatible with that framework. For more information, contact the package author. 
At line:1 char:16 
+ Install-Package <<<< System.Net.Http 
    + CategoryInfo   : NotSpecified: (:) [Install-Package], InvalidOperationException 
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand 

是与WP7.1的Silverlight项目System.Net.Http兼容的,如果是这样,我怎样才能使它工作?

感谢

+0

WP HTTP方法都基于异步和其他HTTP方法未在WP支持同步。因此,建议使用WP SDK中的异步方法。 – nkchandra

+0

System.Net.Http支持异步通信。我不是在寻求关于使用这个程序集的可取性的意见 - 我只想知道它是否可以安装到SP7.1 Silverlight项目中,如果是的话,如何去做。谢谢... –

+0

我在http://nuget.org/packages/System.Net.Http发现了这个说法:“传统包,System.Net.Http现已包含在‘Microsoft.Net.Http’包”。 ,尽管我在尝试将其安装到WP7.1 Silverlight项目时遇到了类似的错误。 –

回答

6

丹·罗斯(在System.Net.Http NuGet包的拥有者)通过电子邮件回应说:“System.Net.Http.dll未在XNA,电话或Silverlight在这一点上支持它。仅支持.NET 4(通过ASP.NET Web API),.NET 4.5以及Windows 8中的.NETCore Profile。“所以这是对这个问题的不幸答案。

2

,因为这出现在谷歌1日公测包现在支持的Windows Phone 7.1的项目

安装用户包管理器控制台

PM>安装,包装Microsoft.Net.Http - 预

Click here for project home page

+0

这对我来说也是一样。 –

3

正如Dan指出的那样,System.Net.Http NuGet包已被弃用,以Microsoft.Net.Http为受益人。对于允许定位Windows Phone 7.1的后者we shipped an update

我们正在努力出货稳定版本,但我们没有时间未定。

相关问题