2

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

Is System.Net.Http compatible with WP7.1 Silverlight projects, and if so, how can I get it working?

Thanks

User97693321
  • 3,336
  • 7
  • 45
  • 69
  • WP Http methods are async based and the other http methods are synchronous which is not supported in WP. Hence it is advisable to use async methods that are part of WP SDK. – nkchandra Sep 21 '12 at 07:26
  • System.Net.Http supports asynchronous communications. I'm not seeking opinions about the advisability of using this assembly - I am only interested in knowing if it can be installed into SP7.1 Silverlight projects, and if so, how to go about doing that. Thanks... – Dan Colasanti Sep 21 '12 at 14:29
  • I found on http://nuget.org/packages/System.Net.Http this statement: "Legacy package, System.Net.Http is now included in the 'Microsoft.Net.Http' package.", although I get a similar error when trying to install it into my WP7.1 Silverlight project. – Dan Colasanti Sep 21 '12 at 16:02
  • 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. – Dan Colasanti Sep 21 '12 at 16:54
  • As was pointed out by Dan, the System.Net.Http NuGet package has been deprecated in favor of [Microsoft.Net.Http](http://nuget.org/packages/Microsoft.Net.Http). For the latter [we shipped an update](http://blogs.msdn.com/b/bclteam/archive/2013/02/18/portable-httpclient-for-net-framework-and-windows-phone.aspx) that allows targeting Windows Phone 7.1. We're working on shipping a stable release but we don't have a date yet. – Immo Landwerth Apr 27 '13 at 16:26

3 Answers3

6

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.

3

As was pointed out by Dan, the System.Net.Http NuGet package has been deprecated in favor of Microsoft.Net.Http. For the latter we shipped an update that allows targeting Windows Phone 7.1.

We're working on shipping a stable release but we don't have a date yet.

Immo Landwerth
  • 3,239
  • 21
  • 22
2

since this comes up 1st on google, the beta package now supports windows phone 7.1 projects

to install user package manager console

PM> Install-Package Microsoft.Net.Http -Pre

Click here for project home page

Bob Rupp
  • 21
  • 1