找不到方法:'System.Threading.Tasks.Task`1 <Microsoft.Rest.ServiceClientCredentials> Microsoft.Rest.Azure.Authentication.UserTokenProvider

时间:2019-08-06 07:02:32

标签: c# .net azure .net-core azure-active-directory

我在下面的代码中得到突出显示的问题

     var restClient = RestClient.Configure()
                    .WithEnvironment(AzureEnvironment.AzureGlobalCloud)
                    .WithBaseUri("https://management.azure.com/")
                    .WithCredentials(creds)
                    .Build();
        var message = new HttpRequestMessage(HttpMethod.Post, url);
// getting issue in below code
       await restClient.Credentials.ProcessHttpRequestAsync(message, new System.Threading.CancellationToken(false)); 

错误:

  

找不到方法:   “ System.Threading.Tasks.Task 1<Microsoft.Rest.ServiceClientCredentials> Microsoft.Rest.Azure.Authentication.UserTokenProvider.LoginByDeviceCodeAsync(System.String, System.String, Microsoft.Rest.Azure.Authentication.ActiveDirectoryServiceSettings, Microsoft.IdentityModel.Clients.ActiveDirectory.TokenCache, System.Func 2)”。

我在dll下面引用了最新版本

  

Microsoft.IdentityModel.Clients.ActiveDirectory->版本4.3.0.0

1 个答案:

答案 0 :(得分:0)

在.net框架Microsoft.Azure.Management.ResourceManager.Fluent->1.24.1中安装4.6.1,它将可以正常工作。请参阅此articleenter image description here