title: Error Registering Dynamics CRM Plugin
body: <p>I have a plugin project built in C# that contains all of my plugins for Microsoft Dynamics CRM. The existing plugins are working correctly and appear to be updating correctly. However, when I attempt to register a new plugin, I am getting the below error.</p>
  <p>The event I'm trying to register is on an entity that already has a <code>Create</code> &amp; <code>Update</code> event attached.  I've seen some other questions about the <code>Unable to load plugin type</code> error, but none of them seem to indicate a specific plugin that can't be loaded. What am I missing here for registering a new plugin?</p>
  <h3>Step Registration Settings</h3>
  <p><a href="https://i.stack.imgur.com/VvaXz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VvaXz.png" alt="Plugin Registration Settings" /></a></p>
  <h3>Existing Registered Steps</h3>
  <p><a href="https://i.stack.imgur.com/y32eU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/y32eU.png" alt="enter image description here" /></a></p>
  <h3>Error</h3>
  <pre><code>Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: Unable to load the plugin type: CCSEQ.Plugins.OpportunityPlugins
  Detail: &lt;OrganizationServiceFault xmlns=&quot;http://schemas.microsoft.com/xrm/2011/Contracts&quot; xmlns:i=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;&gt;
    &lt;ActivityId&gt;f9958fce-2da6-44ce-855e-532e4e8deeac&lt;/ActivityId&gt;
    &lt;ErrorCode&gt;-2147204720&lt;/ErrorCode&gt;
    &lt;ErrorDetails xmlns:a=&quot;http://schemas.datacontract.org/2004/07/System.Collections.Generic&quot; /&gt;
    &lt;Message&gt;Unable to load the plugin type: CCSEQ.Plugins.OpportunityPlugins&lt;/Message&gt;
    &lt;Timestamp&gt;2018-06-06T20:31:33.3462414Z&lt;/Timestamp&gt;
    &lt;ExceptionRetriable&gt;false&lt;/ExceptionRetriable&gt;
    &lt;ExceptionSource i:nil=&quot;true&quot; /&gt;
    &lt;InnerFault&gt;
      &lt;ActivityId&gt;f9958fce-2da6-44ce-855e-532e4e8deeac&lt;/ActivityId&gt;
      &lt;ErrorCode&gt;-2147204720&lt;/ErrorCode&gt;
      &lt;ErrorDetails xmlns:a=&quot;http://schemas.datacontract.org/2004/07/System.Collections.Generic&quot; /&gt;
      &lt;Message&gt;Unable to load the plugin type: CCSEQ.Plugins.OpportunityPlugins&lt;/Message&gt;
      &lt;Timestamp&gt;2018-06-06T20:31:33.3462414Z&lt;/Timestamp&gt;
      &lt;ExceptionRetriable&gt;false&lt;/ExceptionRetriable&gt;
      &lt;ExceptionSource i:nil=&quot;true&quot; /&gt;
      &lt;InnerFault&gt;
        &lt;ActivityId&gt;f9958fce-2da6-44ce-855e-532e4e8deeac&lt;/ActivityId&gt;
        &lt;ErrorCode&gt;-2147220970&lt;/ErrorCode&gt;
        &lt;ErrorDetails xmlns:a=&quot;http://schemas.datacontract.org/2004/07/System.Collections.Generic&quot; /&gt;
        &lt;Message&gt;System.IO.FileLoadException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #0DE0CBC1&lt;/Message&gt;
        &lt;Timestamp&gt;2018-06-06T20:31:33.3462414Z&lt;/Timestamp&gt;
        &lt;ExceptionRetriable&gt;false&lt;/ExceptionRetriable&gt;
        &lt;ExceptionSource i:nil=&quot;true&quot; /&gt;
        &lt;InnerFault i:nil=&quot;true&quot; /&gt;
        &lt;OriginalException i:nil=&quot;true&quot; /&gt;
        &lt;TraceText i:nil=&quot;true&quot; /&gt;
      &lt;/InnerFault&gt;
      &lt;OriginalException i:nil=&quot;true&quot; /&gt;
      &lt;TraceText i:nil=&quot;true&quot; /&gt;
    &lt;/InnerFault&gt;
    &lt;OriginalException i:nil=&quot;true&quot; /&gt;
    &lt;TraceText i:nil=&quot;true&quot; /&gt;
  &lt;/OrganizationServiceFault&gt;
  
  Server stack trace: 
     at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc&amp; 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 Microsoft.Crm.Tools.Libraries.RegistrationHelper.RegisterStep(CrmOrganization org, CrmPluginStep step)
     at Microsoft.Crm.Tools.PluginRegistration.StepRegistrationViewModel.btnRegister_Click(Object sender, EventArgs e)
  </code></pre>
  <hr />
  <h3>Update 1</h3>
  <p>Based on Arun's input, I changed the namespace &amp; dll build name for my C# project and rebuilt the project.  I did this so I wouldn't have to unregister my existing plugins and rebuild them from the ground up.  I registered this new assembly using the plugin registration tool.  When I tried to register a new step, I receive the same error as before.  This occurs for all registered Plugins. The example below is one I tried with Activities (specifically appointments), although I also tried this for Opportunities</p>
  <h3>Step Registration Settings</h3>
  <p><a href="https://i.stack.imgur.com/JFQhb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JFQhb.png" alt="Appointment Registration Settings" /></a></p>
  <h3>Error Message</h3>
  <pre><code>Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: Unable to load the plugin type: COHEN.Plugins.ActivityPlugins
  Detail: &lt;OrganizationServiceFault xmlns=&quot;http://schemas.microsoft.com/xrm/2011/Contracts&quot; xmlns:i=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;&gt;
    &lt;ActivityId&gt;1bf82d05-04d0-4bd0-a3db-87c480cc3c6e&lt;/ActivityId&gt;
    &lt;ErrorCode&gt;-2147204720&lt;/ErrorCode&gt;
    &lt;ErrorDetails xmlns:a=&quot;http://schemas.datacontract.org/2004/07/System.Collections.Generic&quot; /&gt;
    &lt;Message&gt;Unable to load the plugin type: COHEN.Plugins.ActivityPlugins&lt;/Message&gt;
    &lt;Timestamp&gt;2018-06-07T13:57:24.8030045Z&lt;/Timestamp&gt;
    &lt;ExceptionRetriable&gt;false&lt;/ExceptionRetriable&gt;
    &lt;ExceptionSource i:nil=&quot;true&quot; /&gt;
    &lt;InnerFault&gt;
      &lt;ActivityId&gt;1bf82d05-04d0-4bd0-a3db-87c480cc3c6e&lt;/ActivityId&gt;
      &lt;ErrorCode&gt;-2147204720&lt;/ErrorCode&gt;
      &lt;ErrorDetails xmlns:a=&quot;http://schemas.datacontract.org/2004/07/System.Collections.Generic&quot; /&gt;
      &lt;Message&gt;Unable to load the plugin type: COHEN.Plugins.ActivityPlugins&lt;/Message&gt;
      &lt;Timestamp&gt;2018-06-07T13:57:24.8030045Z&lt;/Timestamp&gt;
      &lt;ExceptionRetriable&gt;false&lt;/ExceptionRetriable&gt;
      &lt;ExceptionSource i:nil=&quot;true&quot; /&gt;
      &lt;InnerFault&gt;
        &lt;ActivityId&gt;1bf82d05-04d0-4bd0-a3db-87c480cc3c6e&lt;/ActivityId&gt;
        &lt;ErrorCode&gt;-2147220970&lt;/ErrorCode&gt;
        &lt;ErrorDetails xmlns:a=&quot;http://schemas.datacontract.org/2004/07/System.Collections.Generic&quot; /&gt;
        &lt;Message&gt;System.IO.FileLoadException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #FB840294&lt;/Message&gt;
        &lt;Timestamp&gt;2018-06-07T13:57:24.8030045Z&lt;/Timestamp&gt;
        &lt;ExceptionRetriable&gt;false&lt;/ExceptionRetriable&gt;
        &lt;ExceptionSource i:nil=&quot;true&quot; /&gt;
        &lt;InnerFault i:nil=&quot;true&quot; /&gt;
        &lt;OriginalException i:nil=&quot;true&quot; /&gt;
        &lt;TraceText i:nil=&quot;true&quot; /&gt;
      &lt;/InnerFault&gt;
      &lt;OriginalException i:nil=&quot;true&quot; /&gt;
      &lt;TraceText i:nil=&quot;true&quot; /&gt;
    &lt;/InnerFault&gt;
    &lt;OriginalException i:nil=&quot;true&quot; /&gt;
    &lt;TraceText i:nil=&quot;true&quot; /&gt;
  &lt;/OrganizationServiceFault&gt;
  
  Server stack trace: 
     at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc&amp; 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 Microsoft.Crm.Tools.Libraries.RegistrationHelper.RegisterStep(CrmOrganization org, CrmPluginStep step)
     at Microsoft.Crm.Tools.PluginRegistration.StepRegistrationViewModel.btnRegister_Click(Object sender, EventArgs e)
  </code></pre>
  <hr />
  <h3>Update 2</h3>
  <p>I noticed that we have a post-build step that runs the command:</p>
  <pre><code>mkdir $(TargetDir)merged $(SolutionDir)packages\ILMerge.2.14.1208\tools\ilmerge.exe /out:$(TargetDir)merged\CCSEQ.Plugins.dll /keyfile:$(ProjectDir)customdevelopment.snk $(TargetDir)CCSEQ.Plugins.dll $(TargetDir)Microsoft.SharePoint.Client.dll $(TargetDir)Microsoft.SharePoint.Client.Runtime.dll
  </code></pre>
  <p>This appears to create a new directory in our output folder called <code>merged</code> which contains a version of the dll.  I have tried updating the assembly with this version of the dll, but it errors the same way.  I have tried doing this with both the debug &amp; release versions of our build.</p>
  <p>One other thing I tried is I imported the dll as a reference into my project to try to look at the classes/functions provided by the dll. It appears that there aren't any classes/functions in the dll, but I'm not sure if that means anything or not as I'm not that familiar with dlls.</p>
  <p><a href="https://i.stack.imgur.com/zpjy7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zpjy7.png" alt="Library Classes" /></a></p>