无法将System.Net.Http包安装到Windows Phone 7.1 Silverlight项目中 [英] Can't Install System.Net.Http Package into a Windows Phone 7.1 Silverlight Project
问题描述
我使用Nuget安装了"Microsoft ASP.NET Web API客户端库",以获取用于Windows Phone 7.1 XNA和Silverlight项目的最新System.Net.Http程序集.它可以很好地安装到WP7.1 XNA项目中,但不允许我将其安装到WP7.1 Silverlight项目中.我什至尝试将其直接从Package Manager控制台安装到新创建的WP7.1 Silverlight项目中,并收到以下错误响应:
I used Nuget to install the "Microsoft ASP.NET Web API Client Libraries" to get the latest System.Net.Http assembly for use in Windows Phone 7.1 XNA and Silverlight projects. It installs just fine into my WP7.1 XNA projects, but doesn't allow me to install it into the WP7.1 Silverlight projects. I even tried installing it directly from the Package Manager Console into a newly created WP7.1 Silverlight project and got this Error response:
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
System.Net.Http是否与WP7.1 Silverlight项目兼容,如果可以,如何使它工作?
Is System.Net.Http compatible with WP7.1 Silverlight projects, and if so, how can I get it working?
谢谢
推荐答案
Dan Roth(System.Net.Http Nuget包的所有者)通过电子邮件回复:"XNA不支持System.Net.Http.dll,这时只能使用Phone或Silverlight.仅在.NET 4(通过ASP.NET Web API)、. NET 4.5.和Windows 8中的.NETCore配置文件上受支持."因此,这是对该问题的不幸答案.
Dan Roth (the owner of the System.Net.Http Nuget package) responded via email: "System.Net.Http.dll is not support on XNA, Phone or Silverlight at this point. It is only support on .NET 4 (through ASP.NET Web API), .NET 4.5. and the .NETCore Profile in Windows 8." So that is the unfortunate answer to this question.
这篇关于无法将System.Net.Http包安装到Windows Phone 7.1 Silverlight项目中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!