簡體   English   中英

我似乎無法使 Microsoft CSP SDK for .NET 工作

[英]I can't seem to make the Microsoft CSP SDK for .NET work

我正在嘗試使用 SDK 將我的 CSP 代碼從帶有 Rest API 的 PHP 遷移到 C# .NET,但我似乎無法進行任何示例工作。

現在我正在使用 Azure Functions 來部署代碼,並且在本地調試它時,我經常遇到以下錯誤:

error CS0103: The name 'PartnerCredentials' does not exist in the current context 

我現在嘗試制作的示例是:

using System;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Host;
using Microsoft.Extensions.Logging;
using Microsoft.Store.PartnerCenter;
using System.Linq;
using System.Threading.Tasks;

namespace cspTest
{
    public static class cspTest
    {
        [FunctionName("cspTest")]
        public static void Run([TimerTrigger("0 */1 * * * *")] TimerInfo myTimer, ILogger log)
        {
            IPartnerCredentials partnerCredentials =
                PartnerCredentials.Instance.GenerateByApplicationCredentials(secret, secret,login.microsoftonline.com");

            //  Create operations instance with partnerCredentials.
            return PartnerService.Instance.CreatePartnerOperations(partnerCredentials);
        }
    }
}

感謝您提供任何幫助,這是我第一次同時使用 AZ 和 .NET/C#,所以我不確定我是否遺漏了一些非常明顯的東西,或者我是否犯了一個非常愚蠢的錯誤。

@Fildor 在評論中提供的答案:

您需要使用 Microsoft.Store.PartnerCenter.Extensions; : PartnerCredentials 類

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM