由于工作內(nèi)容股淡,需要使用RestSharp這個(gè)庫身隐。在安裝好NuGet Package Manager之后,以為搜索后就可以安裝唯灵。不知為何贾铝,無法從NuGet中查詢?cè)诰€數(shù)據(jù)。
換成從命令行Package Manager Console中進(jìn)行安裝埠帕,提示如下的錯(cuò)誤:
PM> Install-Package RestSharp -Version 105.2.3
The source at All [(Aggregate source)] is unreachable. Falling back to NuGet Local Cache at C:\Users\seewin\AppData\Local\NuGet\Cache
Install-Package : Unable to find version '105.2.3' of package 'RestSharp'.
At line:1 char:1
+ Install-Package RestSharp -Version 105.2.3
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
檢查NuGet Package Manager的配置:
并沒有發(fā)現(xiàn)什么異常垢揩。從網(wǎng)絡(luò)中搜索了一些資料,給出的答案是Internet存在異常導(dǎo)致敛瓷。參考https://github.com/NuGet/Home/issues/1325叁巨。
沒找到答案,只能只能通過手動(dòng)下載RestSharp進(jìn)行安裝呐籽。
版本選擇
由于VS2010支持的.NET Framework最高版本為v4.0锋勺。目前,RestSharp的最新版本需要依賴.NET Framework 4.5.2:
所以狡蝶,為VS2010安裝依賴時(shí)庶橱,要選擇適當(dāng)?shù)陌惭b包進(jìn)行安裝。由于不需要任何依賴贪惹,這里選擇105.2.3這個(gè)版本進(jìn)行安裝:
https://www.nuget.org/packages/RestSharp/105.2.3
安裝RestSharp
1苏章、從NuGet下載RestSharp安裝包:
2、將安裝包放到默認(rèn)的本地目錄:C:\Users\seewin\AppData\Local\NuGet\Cache
3奏瞬、重新打開Package Manager Console枫绅,執(zhí)行以下命令:
PM> Install-Package RestSharp -Version 105.2.3
PM> Install-Package RestSharp -Version 105.2.3
The source at All [(Aggregate source)] is unreachable. Falling back to NuGet Local Cache at C:\Users\seewin\AppData\Local\NuGet\Cache
Installing 'RestSharp 105.2.3'.
Successfully installed 'RestSharp 105.2.3'.
Adding 'RestSharp 105.2.3' to iDiary.
Successfully added 'RestSharp 105.2.3' to iDiary.
4、查看項(xiàng)目依賴引用:
OK丝格,RestSharp安裝成功撑瞧。