问题
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