Tip #549: Cannot convert A into A

If you were playing with the uber-administrator’s way to create non-intractive users then you might have seen the following error:

Cannot process argument transformation on parameter ‘conn’. Cannot convert the “Microsoft.Xrm.Tooling.Connector.CrmServiceClient” value of type “Microsoft.Xrm.Tooling.Connector.CrmServiceClient” to type “Microsoft.Xrm.Tooling.Connector.CrmServiceClient”.

Ugh? Say again? Cannot convert “A” to “A”?

The other possible error gives away a bit more:

Get-CrmConnection : The component ‘Microsoft.Xrm.Tooling.CrmConnector.Powershell.LoginControl.LoginControlDlg’ does not have a resource identified by the URI
‘/Microsoft.Xrm.Tooling.CrmConnector.Powershell;component/logincontrol/logincontrol.xaml’.

In a nutshell, the above errors are the result of the clash of different versions of Microsoft.Xrm.Tooling.Connector.dll assemblies (and “Cannot convert A to A” is actually “Cannot convert A v1.8 to A v2.0”). How did you end up with the multiple versions?

  1. Imported Microsoft.Xrm.Data.PowerShell module that has a version of the tooling from CRM 2015 distributed with it. (This is done deliberately so that you don’t have to install SDK to use the module)
  2. Installed CRM SDK 2016, registered Microsoft.Xrm.Tooling Powershell snapin and had a valid reason to add it into the current script:
    Add-PSSnapin Microsoft.Xrm.Tooling.Connector
    Import-Module Microsoft.Xrm.Data.Powershell
    

Solution is either don’t use your version of connector or get the right Microsoft.Xrm.Data.Powershell version (there are two distributions) or fiddle with Microsoft.Xrm.Data.Powershell distribution to remove connector from there (isn’t that what Open Source is for?)

Leave a Reply

Your email address will not be published. Required fields are marked *