Plug-in assembly does not contain the required types or assembly content cannot be updated

Microsoft.Crm.Extensibility Common error message and how to resolve

On registering a plugin using plugin registration tool, you might get this error. Here is more details on the error:

Plug-in assembly does not contain the required types or assembly content cannot be updated.

The details of the error message (XML) looks like the following

'code' <OrganizationServiceFault xmlns="http://schemas.microsoft.com/xrm/2011/Contracts" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> <ErrorCode>-2147204725</ErrorCode> <ErrorDetails xmlns:a="http://schemas.datacontract.org/2004/07/System.Collections.Generic"> <KeyValuePairOfstringanyType> <a:key>CallStack</a:key> <a:value i:type="b:string" xmlns:b="http://www.w3.org/2001/XMLSchema"> at Microsoft.Crm.Extensibility.VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context) at Microsoft.Crm.Extensibility.Pipeline.Execute(PipelineExecutionContext context) at Microsoft.Crm.Extensibility.MessageProcessor.Execute(PipelineExecutionContext context) at Microsoft.Crm.Extensibility.InternalMessageDispatcher.Execute(PipelineExecutionContext context) at Microsoft.Crm.Extensibility.ExternalMessageDispatcher.ExecuteInternal(IInProcessOrganizationServiceFactory serviceFactory, IPlatformMessageDispatcherFactory dispatcherFactory, String messageName, String requestName, Int32 primaryObjectTypeCode, Int32 secondaryObjectTypeCode, ParameterCollection fields, CorrelationToken correlationToken, CallerOriginToken originToken, UserAuth userAuth, Guid callerId, Guid transactionContextId, Int32 invocationSource, Nullable1 requestId, Version endpointVersion) at Microsoft.Crm.Extensibility.OrganizationSdkServiceInternal.ExecuteRequest(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType, UserAuth userAuth, Guid targetUserId, Boolean traceRequest, OrganizationContext context, Boolean returnResponse) at Microsoft.Crm.Extensibility.OrganizationSdkServiceInternal.ExecuteRequest(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType) at Microsoft.Crm.Extensibility.OrganizationSdkServiceInternal.Update(Entity entity, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType)&lt;/a:value&gt; &lt;/KeyValuePairOfstringanyType&gt; &lt;/ErrorDetails&gt; &lt;Message&gt;Plug-in assembly does not contain the required types or assembly content cannot be updated.&lt;/Message&gt; &lt;Timestamp&gt;2014-07-16T22:10:31.8203518Z&lt;/Timestamp&gt; &lt;InnerFault&gt; &lt;ErrorCode&gt;-2147204725&lt;/ErrorCode&gt; &lt;ErrorDetails xmlns:a="http://schemas.datacontract.org/2004/07/System.Collections.Generic"&gt; &lt;KeyValuePairOfstringanyType&gt; &lt;a:key&gt;CallStack&lt;/a:key&gt; &lt;a:value i:type="b:string" xmlns:b="http://www.w3.org/2001/XMLSchema"&gt; at Microsoft.Crm.CrmPluginAssemblyMetadata.GetPluginTypeMetadata(String typeName) at Microsoft.Crm.ObjectModel.PluginTypeValidator.ValidateInternal() at Microsoft.Crm.ObjectModel.PluginValidatorBase.Validate() at Microsoft.Crm.ObjectModel.AssemblyDataCanBeUpdatedValidator.ValidateInternal() at Microsoft.Crm.ObjectModel.PluginAssemblyServiceInternal1.VerifyRegistrationAbility(IBusinessEntity pluginAssembly, Boolean createCall, ExecutionContext context) at Microsoft.Crm.ObjectModel.SdkEntityServiceBase.UpdateInternal(IBusinessEntity entity, ExecutionContext context, Boolean verifyAction) at Microsoft.Crm.ObjectModel.PluginAssemblyServiceInternal`1.Update(IBusinessEntity entity, ExecutionContext context)</a:value> </KeyValuePairOfstringanyType> </ErrorDetails> <Message>Plug-in assembly does not contain the required types or assembly content cannot be updated.</Message> <Timestamp>2014-07-16T22:10:31.8203518Z</Timestamp> <InnerFault i:nil="true" /> <TraceText i:nil="true" /> </InnerFault> <TraceText i:nil="true" /> </OrganizationServiceFault>

Server stack trace: at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at Microsoft.Xrm.Sdk.IOrganizationService.Update(Entity entity) at Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy.UpdateCore(Entity entity) at Microsoft.Crm.Tools.PluginRegistration.RegistrationHelper.UpdateAssembly(CrmOrganization org, String pathToAssembly, CrmPluginAssembly assembly, PluginType[] type) at Microsoft.Crm.Tools.PluginRegistration.PluginRegistrationForm.btnRegister_Click(Object sender, EventArgs e)

Reason?

There could be many reasons for this error message which I am sure there are many articles on the net talking about it. But this was the scenario for us:

The Plugin which has been registered previously had a step which has been removed! Suppose you have register the plugin assembly with three steps A, B and C. you have then forgot to remove Step B from CRM but you have deleted the corresponding plugin class. Hence you compiled new plugin would not expect to get Step B during plugin update!

How toResolve?

You need to find out which step needs to be unregistered before you can update the plugin assembly. If in TFS try to review the history to see what class has been removed and delete the corresponding plugin steps.