-1
所以我已經成功上傳的NuGet包到我的蔚藍的功能,但它不斷給我這個錯誤:Contentful.Csharp NuGet包在Azure中
"The type or namespace name 'ContentfulClient' could not be found (are you missing a using directive or an assembly reference?)"
我已經安裝了從項目的NuGet包。 json文件。
這是我的代碼:
using System.Net;
using System.Net.Http;
private static HttpClient httpClient;
private static ContentfulClient contentfulClient;
private static ContentfulClient contentfulPreviewClient;
public static async Task<HttpResponseMessage> Run(HttpRequestMessage req,
TraceWriter log){
log.Info("C# HTTP trigger function processed a request.");
httpClient = new HttpClient();
contentfulClient = new ContentfulClient(httpClient,
"f802e4676d16fc1476580e4a50c8f3b180b875eaffad0680a55139f3338d5ac3","i6w3gtjaaewo");
contentfulPreviewClient = new ContentfulClient(httpClient,
"e9da3ff45bc38a213c41ac768732c0ac75df5c453a2ed651bfd946cb5f226c5f", "i6w3gtjaaewo", true);
log.Info("C# HTTP trigger function processed a request.");
// parse query parameter
string name = req.GetQueryNameValuePairs()
.FirstOrDefault(q => string.Compare(q.Key, "name", true) == 0)
.Value;
// Get request body
dynamic data = await req.Content.ReadAsAsync<object>();
// Set name to query string or body data
name = name ?? data?.name;
return name == null
? req.CreateResponse(HttpStatusCode.BadRequest, "Please pass a name on
the query string or in the request body")
: req.CreateResponse(HttpStatusCode.OK, "Hello " + name);
}
嗯,我沒有看到一個'使用'指令......你只是缺少'使用Contentful.Core;'? –
''從project.json文件中安裝nuget包'你能分享你的project.json文件的細節嗎?請檢查安裝Package contentful.csharp是否在Azure功能日誌中成功。 –
我已經通過project.json文件安裝了nuget包。 – Satyops