2

Nuget を使用して「Microsoft ASP.NET Web API クライアント ライブラリ」をインストールし、Windows Phone 7.1 XNA および Silverlight プロジェクトで使用する最新の System.Net.Http アセンブリを取得しました。WP7.1 XNA プロジェクトには問題なくインストールできますが、WP7.1 Silverlight プロジェクトにはインストールできません。パッケージ マネージャー コンソールから新しく作成した WP7.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

System.Net.Http は WP7.1 Silverlight プロジェクトと互換性がありますか? もしそうなら、どのように動作させることができますか?

ありがとう

4

3 に答える 3

6

Dan Roth (System.Net.Http Nuget パッケージの所有者) は、電子メールで次のように回答しています。 ASP.NET Web API)、.NET 4.5、および Windows 8 の .NETCore プロファイル」それがこの質問に対する残念な答えです。

于 2012-09-21T16:55:01.967 に答える
2

これは Google で 1 位になったので、ベータ パッケージは Windows Phone 7.1 プロジェクトをサポートするようになりました。

ユーザー パッケージ マネージャー コンソールをインストールするには

PM> インストール パッケージ Microsoft.Net.Http -Pre

プロジェクトホームページはこちら

于 2013-02-27T01:42:31.187 に答える