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:
<assemblyIdentity name=“Microsoft.Crm.Sdk” publicKeyToken=“31bf3856ad364e35” culture=“neutral“ />
<bindingRedirect oldVersion=“126.96.36.199-188.8.131.52” newVersion=“184.108.40.206“ />
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.