Failed instantiating XrmClient
Hi @AymericM78,
I'm trying your module for the first time, specifically version 2.0.010, running on PowerShell 5.1.
The New-XrmClient cmdlet fails with an OAuth connection string if I pass in a username and password in the format AuthType=OAuth;Url=$serverURL;Username=$username;Password=$password
The same credentials work fine with Connect-CrmOnline using the Microsoft.Xrm.Data.PowerShell module.
Did you have any thoughts on this?
Thanks
I have just retested with ClientSecret authentication and I get the same error. The error is as follows:
Exception calling ".ctor" with "1" argument(s): "Method not found: 'Microsoft.Extensions.Options.OptionsBuilder`1<!!0> Microsoft.Extensions.DependencyInjection.OptionsServiceCollectionExtensions.AddOptions(Microsoft.Extensions.DependencyInjection.IServiceCollection)'."
Hello @parvezghumra
I did the same on my side and it's OK. This error seems to be related to a bad .NET SDK version on your computer which can corrupt assembly loading. Can you share $PSVersionTable command result please? And can you try this on VS Code or Powershell ISE ?
Thanks
@AymericM78 I'm already running my script in VS Code. Here's the output of $PSVersionTable
Name Value PSVersion 5.1.26100.6725 PSEdition Desktop PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} BuildVersion 10.0.26100.6725 CLRVersion 4.0.30319.42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1
OK, this seems to be good.
Can you try outside VsCode please ? I faced an issue recently where VSCode extensions load different .NET dll in memory and corrupt CrmSdk load.
Thanks