Search code examples
pluginsdynamics-crmcrmon-premises-instances

Error connecting to organization using XRMToolKit Error Message: A proxy type with the name pluginassembly has been defined by another assembly


I am using XRMToolkit to connect to my On-Premises organization. I am using XRMToolkit Version 7.3.4.0. Another dev has been able to connect using the same toolkit version to the same organization I am trying to connect to. I have researched and have not found an answer to my question. My question is how to fix this error? From the looks of if, the toolkit is recognizing another assembly. I am not sure. Below is the relevant error message from the log. NOTE: where you see 'xxx' is where I deleted the actual guid or id.

There was an error connecting to the organization.

System.Exception: Failed to Executed Command - WhoAmIRequest : RequestId=xxx : total duration: 00:00:02.3729929
Failed to Executed Command - WhoAmIRequest : RequestId=xxx : total duration: 00:00:02.3729929************ Exception - Failed to lookup current user
A proxy type with the name pluginassembly has been defined by another assembly. Current type: XrmToolkit.Crm.ProxyClasses.PlugInAssembly, XrmToolkit.Crm.Proxies, Version=7.3.4.0, Culture=neutral, PublicKeyToken=null, Existing type: CrmSdk.PluginAssembly, CrmLibraries, Version=9.0.0.0, Culture=neutral, PublicKeyToken=xxx
Parameter name: pluginassemblyUnable to connect to CRM: A proxy type with the name pluginassembly has been defined by another assembly. Current type: XrmToolkit.Crm.ProxyClasses.PlugInAssembly, XrmToolkit.Crm.Proxies, Version=7.3.4.0, Culture=neutral, PublicKeyToken=null, Existing type: CrmSdk.PluginAssembly, CrmLibraries, Version=9.0.0.0, Culture=neutral, PublicKeyToken=xxx
Parameter name: pluginassembly
A proxy type with the name pluginassembly has been defined by another assembly. Current type: XrmToolkit.Crm.ProxyClasses.PlugInAssembly, XrmToolkit.Crm.Proxies, Version=7.3.4.0, Culture=neutral, PublicKeyToken=null, Existing type: CrmSdk.PluginAssembly, CrmLibraries, Version=9.0.0.0, Culture=neutral, PublicKeyToken=xxx
Parameter name: pluginassemblyUnable to Login to Dynamics CRM
Unable to Login to Dynamics CRM
   at XrmToolkit.Crm.Extensions.ConnectionInfoExtensions.<>c__DisplayClass0_0.<<GetCrmServiceClientAsync>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at XrmToolkit.Crm.Extensions.ConnectionInfoExtensions.<GetCrmServiceClientAsync>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at XrmToolkit.UI.Wpf.Forms.ConnectToOrganization.<ConnectAsync>d__21.MoveNext()

I tried uninstalling xrmtoolkit and reinstalling. I expected that the correct files would be referenced. I searched for hours for how to fix this. Not much regarding this particular error out there.


Solution

  • XRM Toolkit seems to reference assemblies XrmToolkit.Crm.Proxies and CrmLibraries. Apparently both define a proxy class for entity pluginassembly (XrmToolkit.Crm.ProxyClasses.PlugInAssembly and CrmSdk.PluginAssembly), so the data contract serializer cannot determine which to choose. Hence the error message.

    If CrmLibraries.dll is a component you control you probably can fix this issue by removing the entity from this library. Otherwise you could try locating it on your machine and decide what you can do with it.

    XRM Toolkit is commercial software and when you do not use a trial version you should be able to get support. If not, try XRM Toolbox instead. It is free.