![](/img/trans.png)
[英]Downloading a Nuget package is giving the error “Package contains an entry which is unsafe for extraction” why?
[英]Which nuget package contains the method GetSheetService()?
我想知道是否有包含 GetSheetService() 的 nuget 包,我找不到哪個是正確的包,有人知道嗎? 有人用過這個方法嗎?
這是我安裝的軟件包:
<ItemGroup>
<PackageReference Include="Google.Apis" Version="1.40.3" />
<PackageReference Include="Google.Apis.Auth" Version="1.40.3" />
<PackageReference Include="Google.Apis.Auth.Mvc" Version="1.40.3" />
<PackageReference Include="Google.Apis.Sheets.v4" Version="1.40.3.1694" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.28" />
</ItemGroup>
這是cs文件的開始:
using System;
using System.IO;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using Google.Apis.Sheets.v4;
google .net 客戶端庫沒有稱為 get sheet 服務的方法。 我懷疑你是從某些地方的某人代碼中復制的。 創建sheet服務的正確方法如下
/// <summary>
/// This method get a valid service
/// </summary>
/// <param name="credential">Authecated user credentail</param>
/// <returns>SheetsService used to make requests against the Sheets API</returns>
private static SheetsService GetService(UserCredential credential)
{
try
{
if (credential == null)
throw new ArgumentNullException("credential");
// Create Sheets API service.
return new SheetsService(new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = "Sheets Oauth2 Authentication Sample"
});
}
catch (Exception ex)
{
throw new Exception("Get Sheets service failed.", ex);
}
}
}
從我的 google .net 客戶端庫示例項目中提取的代碼。 Oauth2Authentication.cs)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.