Any command on Fluent.Azure Results in “Method not found”

空扰寡人 提交于 2021-02-11 13:41:24

问题


Any command on Fluent.Azure results in a "Method not found" exception.

System.MissingMethodException: Method not found: 'Void Microsoft.Rest.TokenCredentials..ctor(Microsoft.Rest.ITokenProvider, System.String, System.String)'.

Looking it up online and there isn't a constructor like that: https://docs.microsoft.com/en-us/dotnet/api/microsoft.rest.tokencredentials.-ctor?view=azure-dotnet

I am creating the azure object like so, and it seems to be working.

var azure = Microsoft.Azure.Management.Fluent.Azure
    .Authenticate(credentials)
    .WithDefaultSubscription()
    ;

But as soon as I try either of the following commands, I get this exception:

var l = await azure.VirtualMachines.ListAsync();
    
var webapp = azure.WebApps.GetByResourceGroup(resourceGroup, name);

I'm referencing v. 1.34.0 of Microsoft.Azure.Management.Fluent for .NET 4.7.2.

And it has these dependencies:

And my references do fall within these ranges:


回答1:


Upgrading Microsoft.Rest.ClientRuntime to 2.3.21 and Microsoft.Rest.ClientRuntime.Azure.Authentication to 2.4.1 seems to have resolved myissue.



来源:https://stackoverflow.com/questions/62838079/any-command-on-fluent-azure-results-in-method-not-found

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!