注册Dynamics CRM插件时出错

时间:2018-06-06 20:36:23

标签: c# plugins dynamics-crm microsoft-dynamics

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

我正在尝试注册的事件是在已经拥有Create& Update事件已附加。我已经看到了关于Unable to load plugin type错误的其他一些问题,但它们似乎都没有表明无法加载的特定插件。我在这里缺少注册新插件的内容吗?

步骤注册设置

Plugin Registration Settings

现有注册步骤

enter image description here

错误

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的输入,我更改了命名空间&amp;为我的C#项目构建名称并重建项目。我这样做了所以我不必取消注册我现有的插件并从头开始重建它们。我使用插件注册工具注册了这个新程序集。当我尝试注册新步骤时,我收到与以前相同的错误。这适用于所有已注册的插件。以下示例是我尝试使用活动(特别是约会)的例子,尽管我也尝试过这个机会

步骤注册设置

Appointment Registration Settings

错误消息

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更新程序集,但它的错误方式相同。我试过用debug和amp;发布我们版本的版本。

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

Library Classes

2 个答案:

答案 0 :(得分:1)

我们发现9.0.2.3的{​​{1}}版本与我们的插件不兼容。我们尚不能确定为什么这行不通,但是回滚到版本Microsoft.CrmSdk.CoreAssemblies可以解决此问题。

答案 1 :(得分:0)

如果您的插件程序集版本不匹配,就会发生这种情况。构建最新代码,注册程序集(dll),选择所有插件&amp;然后尝试注册一个新的步骤

当您在事件处理程序值下注册步骤时,我看到插件名称从CCSEQ.Plugins.OpportunityPlugins更改为Opportunity

你还提到了其他步骤如create&amp;删除,但我看到创建&amp;更新。您确定要更新正确的插件吗?

验证插件项目是否为汇编下列出的插件的类文件,您可以根据这些插件注册步骤。