首页 > 解决方案 > 注册 Dynamics CRM 插件时出错

问题描述

我有一个用 C# 构建的插件项目,其中包含我所有的 Microsoft Dynamics CRM 插件。现有插件工作正常,并且似乎正在正确更新。但是,当我尝试注册新插件时,出现以下错误。

我尝试注册的事件位于已附加Create&Update事件的实体上。我已经看到有关该Unable to load plugin type错误的其他一些问题,但似乎都没有表明无法加载的特定插件。我在这里注册新插件时缺少什么?

步骤注册设置

插件注册设置

现有注册步骤

在此处输入图像描述

错误

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: <OrganizationServiceFault xmlns="http://schemas.microsoft.com/xrm/2011/Contracts" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
  <ActivityId>f9958fce-2da6-44ce-855e-532e4e8deeac</ActivityId>
  <ErrorCode>-2147204720</ErrorCode>
  <ErrorDetails xmlns:a="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
  <Message>Unable to load the plugin type: CCSEQ.Plugins.OpportunityPlugins</Message>
  <Timestamp>2018-06-06T20:31:33.3462414Z</Timestamp>
  <ExceptionRetriable>false</ExceptionRetriable>
  <ExceptionSource i:nil="true" />
  <InnerFault>
    <ActivityId>f9958fce-2da6-44ce-855e-532e4e8deeac</ActivityId>
    <ErrorCode>-2147204720</ErrorCode>
    <ErrorDetails xmlns:a="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
    <Message>Unable to load the plugin type: CCSEQ.Plugins.OpportunityPlugins</Message>
    <Timestamp>2018-06-06T20:31:33.3462414Z</Timestamp>
    <ExceptionRetriable>false</ExceptionRetriable>
    <ExceptionSource i:nil="true" />
    <InnerFault>
      <ActivityId>f9958fce-2da6-44ce-855e-532e4e8deeac</ActivityId>
      <ErrorCode>-2147220970</ErrorCode>
      <ErrorDetails xmlns:a="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
      <Message>System.IO.FileLoadException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #0DE0CBC1</Message>
      <Timestamp>2018-06-06T20:31:33.3462414Z</Timestamp>
      <ExceptionRetriable>false</ExceptionRetriable>
      <ExceptionSource i:nil="true" />
      <InnerFault i:nil="true" />
      <OriginalException i:nil="true" />
      <TraceText i:nil="true" />
    </InnerFault>
    <OriginalException i:nil="true" />
    <TraceText i:nil="true" />
  </InnerFault>
  <OriginalException i:nil="true" />
  <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 Microsoft.Crm.Tools.Libraries.RegistrationHelper.RegisterStep(CrmOrganization org, CrmPluginStep step)
   at Microsoft.Crm.Tools.PluginRegistration.StepRegistrationViewModel.btnRegister_Click(Object sender, EventArgs e)

更新 1

根据 Arun 的输入,我更改了 C# 项目的命名空间和 dll 构建名称并重建了项目。我这样做是为了不必取消注册现有的插件并从头开始重建它们。我使用插件注册工具注册了这个新程序集。当我尝试注册一个新步骤时,我收到与以前相同的错误。这发生在所有已注册的插件上。下面的示例是我尝试使用活动(特别是约会)的示例,尽管我也尝试过用于机会

步骤注册设置

预约注册设置

错误信息

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: <OrganizationServiceFault xmlns="http://schemas.microsoft.com/xrm/2011/Contracts" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
  <ActivityId>1bf82d05-04d0-4bd0-a3db-87c480cc3c6e</ActivityId>
  <ErrorCode>-2147204720</ErrorCode>
  <ErrorDetails xmlns:a="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
  <Message>Unable to load the plugin type: COHEN.Plugins.ActivityPlugins</Message>
  <Timestamp>2018-06-07T13:57:24.8030045Z</Timestamp>
  <ExceptionRetriable>false</ExceptionRetriable>
  <ExceptionSource i:nil="true" />
  <InnerFault>
    <ActivityId>1bf82d05-04d0-4bd0-a3db-87c480cc3c6e</ActivityId>
    <ErrorCode>-2147204720</ErrorCode>
    <ErrorDetails xmlns:a="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
    <Message>Unable to load the plugin type: COHEN.Plugins.ActivityPlugins</Message>
    <Timestamp>2018-06-07T13:57:24.8030045Z</Timestamp>
    <ExceptionRetriable>false</ExceptionRetriable>
    <ExceptionSource i:nil="true" />
    <InnerFault>
      <ActivityId>1bf82d05-04d0-4bd0-a3db-87c480cc3c6e</ActivityId>
      <ErrorCode>-2147220970</ErrorCode>
      <ErrorDetails xmlns:a="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
      <Message>System.IO.FileLoadException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #FB840294</Message>
      <Timestamp>2018-06-07T13:57:24.8030045Z</Timestamp>
      <ExceptionRetriable>false</ExceptionRetriable>
      <ExceptionSource i:nil="true" />
      <InnerFault i:nil="true" />
      <OriginalException i:nil="true" />
      <TraceText i:nil="true" />
    </InnerFault>
    <OriginalException i:nil="true" />
    <TraceText i:nil="true" />
  </InnerFault>
  <OriginalException i:nil="true" />
  <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 Microsoft.Crm.Tools.Libraries.RegistrationHelper.RegisterStep(CrmOrganization org, CrmPluginStep step)
   at Microsoft.Crm.Tools.PluginRegistration.StepRegistrationViewModel.btnRegister_Click(Object sender, EventArgs e)

更新 2

我注意到我们有一个运行命令的后期构建步骤:

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

这似乎在我们的输出文件夹中创建了一个新目录,merged其中包含一个版本的 dll。我曾尝试使用此版本的 dll 更新程序集,但它的错误方式相同。我已经尝试使用我们构建的调试和发布版本来执行此操作。

我尝试的另一件事是将 dll 作为参考导入到我的项目中,以尝试查看 dll 提供的类/函数。dll中似乎没有任何类/函数,但我不确定这是否意味着什么,因为我对dll不太熟悉。

库类

标签: c#pluginsdynamics-crmmicrosoft-dynamics

解决方案


我们发现该版本与我们9.0.2.3Microsoft.CrmSdk.CoreAssemblies插件不兼容。我们还不确定为什么这不起作用,但回滚到版本8.2.0.2解决了这个问题。


推荐阅读