Microsoft Dynamics CRM 2011 Upgrade from RTM to UR6 breaks 4.0 plugins or workflow assemblies
This article provides a resolution for the corrupt web.config file that breaks 4.0 plugins or workflow assemblies when upgrading from Microsoft Dynamics CRM 2011 RTM to Update Rollup 6.
Applies to: Microsoft Dynamics CRM 2011
Original KB number: 2705840
Symptoms
When upgrading from Microsoft Dynamics CRM 2011 RTM to Update Rollup 6 directly, then importing a Microsoft Dynamics CRM 4.0 database with plugins or workflow assemblies, a necessary section from the web.config may be removed.
You will receive errors such as:
System.InvalidCastException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #7A680103: System.InvalidCastException: Unable to cast object of type 'Publisher.Plugins.AutonumberPlugin' to type 'Microsoft.Crm.Sdk.IPlugin'.
Or
Crm Exception: Message: Unable to load the plugin type: Publisher.Plugins.AutonumberPlugin+AccountCreate, ErrorCode: -2147204720, InnerException: System.IO.FileLoadException: Could not load file or assembly 'Microsoft.Crm.Sdk, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'Microsoft.Crm.Sdk, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
at System.Reflection.RuntimeAssembly.GetType(RuntimeAssembly assembly, String name, Boolean throwOnError, Boolean ignoreCase, ObjectHandleOnStack type)
at System.Reflection.RuntimeAssembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase)
at Microsoft.Crm.Extensibility.PluginTypeFactory.LoadType(String qualifiedTypeName, Assembly assembly)
Or
Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: Unable to load the plugin type: PlugInName:
<OrganizationServiceFault xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://schemas.microsoft.com/xrm/2011/Contracts">
<ErrorCode>-2147204720
<ErrorDetails xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
<Message>Unable to load the plugin type: PlugInName
<Timestamp>Timestamp
<InnerFault i:nil="true" />
<TraceText i:nil="true" />
</OrganizationServiceFault>
Cause
This is caused by a corrupt web.config file.
Resolution
Insert the section below to the Microsoft Dynamics CRM web.config file directly after the following tag:
</system.diagnostics>
Note
The default location of the Microsoft Dynamics CRM web.config is C:\Program Files\Microsoft Dynamics CRM\CRMWeb
or C:\inetpub\Microsoft Dynamics CRM\CRMWeb
.
Add this section:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Crm.Sdk" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="4.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
If there is an empty runtime tag, remove it and replace with the new section.
Note
It is recommended to do this after business hours, as it will recycle the CRMAppPool.