1

私は数週間前にプロジェクトに取り掛かり、パッケージマネージャーコンソールを開き、コマンドInstall-Package Google.Apis.Drive.v3を実行しました。すべてがうまくいっていて、何の問題もありませんでした...しかし、今私はそれをやろうとすると、このパッケージがFramework 4.0をサポートしていないことを私に知らせるエラーが出ます!Nugetパッケージをインストールするフレームワーク4.0のGoogle.Apis.Drive.v3

PM> Install-Package Google.Apis.Drive.v3 
Attempting to resolve dependency 'Google.Apis (≥ 1.11.1)'. 
Attempting to resolve dependency 'Google.Apis.Core (≥ 1.11.1)'. 
Attempting to resolve dependency 'Microsoft.Bcl (≥ 1.1.10)'. 
Attempting to resolve dependency 'Microsoft.Bcl.Build (≥ 1.0.14)'. 
Attempting to resolve dependency 'Microsoft.Bcl.Async (≥ 1.0.168)'. 
Attempting to resolve dependency 'Microsoft.Net.Http (≥ 2.2.29)'. 
Attempting to resolve dependency 'Newtonsoft.Json (≥ 7.0.1)'. 
Attempting to resolve dependency 'Zlib.Portable.Signed (≥ 1.11.0)'. 
Attempting to resolve dependency 'Google.Apis.Auth (≥ 1.11.1)'. 
Installing 'Microsoft.Net.Http 2.2.29'. 
You are downloading Microsoft.Net.Http from Microsoft, the license agreement to which is available at http://go.microsoft.com/fwlink/?LinkId=329770. 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.2.29'. 
Installing 'Newtonsoft.Json 7.0.1'. 
Successfully installed 'Newtonsoft.Json 7.0.1'. 
Installing 'Google.Apis.Core 1.11.1'. 
Successfully installed 'Google.Apis.Core 1.11.1'. 
Installing 'Zlib.Portable.Signed 1.11.0'. 
You are downloading Zlib.Portable.Signed from AdvancedREI, onovotny, the license agreement to which is available at http://en.wikipedia.org/wiki/Zlib_License. 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 'Zlib.Portable.Signed 1.11.0'. 
Installing 'Google.Apis 1.11.1'. 
Successfully installed 'Google.Apis 1.11.1'. 
Installing 'Google.Apis.Auth 1.11.1'. 
Successfully installed 'Google.Apis.Auth 1.11.1'. 
Installing 'Google.Apis.Drive.v3 1.11.1.434'. 
Successfully installed 'Google.Apis.Drive.v3 1.11.1.434'. 
Adding 'Microsoft.Net.Http 2.2.29' to Drilyser. 
Successfully added 'Microsoft.Net.Http 2.2.29' to Drilyser. 
Adding 'Newtonsoft.Json 7.0.1' to Drilyser. 
Successfully added 'Newtonsoft.Json 7.0.1' to Drilyser. 
Adding 'Google.Apis.Core 1.11.1' to Drilyser. 
Uninstalling 'Google.Apis.Core 1.11.1'. 
Successfully uninstalled 'Google.Apis.Core 1.11.1'. 
Uninstalling 'Newtonsoft.Json 7.0.1'. 
Successfully uninstalled 'Newtonsoft.Json 7.0.1'. 
Uninstalling 'Microsoft.Net.Http 2.2.29'. 
Successfully uninstalled 'Microsoft.Net.Http 2.2.29'. 
Install failed. Rolling back... 
Install-Package : Could not install package 'Google.Apis.Core 1.11.1'. You are trying t 
o install this package into a project that targets '.NETFramework,Version=v4.0', but th 
e package does not contain any assembly references or content files that are compatible 
with that framework. For more information, contact the package author. 
At line:1 char:16 
+ Install-Package <<<< Google.Apis.Drive.v3 
    + CategoryInfo   : NotSpecified: (:) [Install-Package], InvalidOperationExc 
    eption 
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands. 
    InstallPackageCommand 

私はVS2010で開発し、フレームワーク4.0を使用します。だから私の環境にインストールするには、このパッケージが必要です。彼らはおそらく、過去数週間以内にリリースされたバージョンで4.5+のみをサポートするようにパッケージを変更しましたか?どのように私はこれを回避することができます任意のアイデア?

私の目標は、GoogleドライブAPIにアクセスし、hereの例に従うことです。

答えて

2

参照:https://www.nuget.org/packages/Google.Apis/サポートされるプラットフォームは.Net Framework 4.5

Drive API.v3の最新バージョン.Net Framework 4.5の最新バージョンのみで指定されています。

実際に.Net Framework 4.0で使用する必要がある場合は、以前のバージョンのパッケージをインストールすることをお勧めします。
Google.Apis.Drive.v3 Client Library 1.10.0.130は、.Net 4.0.Net 4.5の両方をサポートしているようです。このバージョンは、以前のバージョンを試し、その後、うまくいかなかった場合は、この特定のバージョン

Install-Package Google.Apis.Drive.v3 -Version 1.10.0.130 

をインストールする

このコマンドを使用。お役に立てれば。

+1

完璧、ありがとう!この回答は、4.0の環境で動作させるためにインクルードしたコマンドのために受け入れられたマークを受けました。また、迅速な対応に感謝します! –

0

私はあなたがこのパッケージについて話していると思う:Google.Apis.drive.v3あなたが見ることができるように、それは次のプラットフォームをサポートします。

**Supported Platforms:** 
- .NET Framework 4.5 
- Windows Store apps 
- Windows Phone 8 and 8.1 
- Portable Class Libraries 

ので、それは文句を言わない4.0をサポートし、それをアップグレードしてください。

+0

私はVishnu Prasadの回答ごとにバージョン1.10.0.130をインストールすることになりました。私はまだ最新のVSのコピーを持っていないので、私は現在4.0にバインドされていますが、情報に感謝します。 –

1

Googleの.Netクライアントライブラリの2016年リリースv1.11は、.Net Framework 4.0のサポートが中止されました(#696参照)。

現在、Nuget Getパッケージには、.Net 4.0プロジェクトにインストールしようとすると、古いパッケージをサポートしていないか、パッケージで開発したものをダウンロードする必要があります。以前のバージョンのv1.10を自分でダウンロードしてしまうことは回避されています。 (Link

また、プロジェクトを.net framework 4.5にアップグレードし、サポートされているライブラリ部分を使用することもできます。

更新:

あなたはそれ以上の更新がないことに注意して、ライブラリの.NET 4.0のバージョンを使用し続けることを選択した場合。これは、コアライブラリだけでなく、生成されたすべてのAPIライブラリにもあります。使用しているAPIが何かをリリースしたり変更したりすると、これらの変更は行われません。

Install-Package Google.Apis.Drive.v3 -Version 1.10.0.130 
+0

+1非常に有用な情報です!この問題について少し深く掘り下げてくれてありがとう。さて、ナゲットがどうやってもっとうまくいくのか理解しています。 ;) –

+0

私はこのプロジェクトに貢献しています。混乱を招いてごめんなさい。 – DaImTo

関連する問題