Unable to cast object of type ‘xxxx’ to type ‘Microsoft.Crm.Sdk.IPlugin’

We recently ran into some issues during one of our CRM 2011 installations. To give you some more background info, this particular installation was a fresh installation of CRM 2011 based on an upgraded CRM 4.0 installation.

The upgrades we did in the past went fine; the only difference with this one is the fact that it was not an upgrade, but a complete new installation.

After the installation and uploading our solutions, I tried a first test to see if all plugins and custom code was running OK. But unfortunately the test failed on the first run.

The exception I received was: Unable to cast object of type ‘xxxx’ to type ‘Microsoft.Crm.Sdk.IPlugin’

I’ve spent hours trying to figure out what was wrong here. I first tried adding some of the old CRM 4.0 assemblies to the GAC, recompiling the plugins so that they use to x64 assembly references, but all with little luck.

I suddenly got the idea to compare the new installation with one of the successfully upgraded installations and this got me to the Web.config file of the CRM website.

It seems the following section was missing in my web.config file:

 <assemblyBinding xmlns=urn:schemas-microsoft-com:asm.v1>
<assemblyIdentity name=Microsoft.Crm.SdkpublicKeyToken=31bf3856ad364e35culture=neutral />
<bindingRedirect oldVersion= />

After adding this section at the bottom of the Web.config, all my plugins were executing without any issues. Not sure where this section came from, if MS automatically injects it during an upgrade or not.

Anyway, this seemed to solve the issue for me.



Tagged with: , ,
Posted in CRM 2011
3 comments on “Unable to cast object of type ‘xxxx’ to type ‘Microsoft.Crm.Sdk.IPlugin’
  1. Dj says:

    It resloved my issue as well

  2. Wei Ma says:

    I think Microsoft took your idea without giving you any credit. http://support.microsoft.com/kb/2705840

  3. Umer Javed says:

    Thanks it resolved our issue as well

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: