代码之家  ›  专栏  ›  技术社区  ›  Tim Hutchison

注册动态CRM插件时出错

  •  1
  • Tim Hutchison  · 技术社区  · 7 年前

    我有一个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的输入,我更改了我的c项目的名称空间&dll构建名称,并重新构建了该项目。我这样做是为了不必注销我现有的插件并从头开始重建它们。我使用插件注册工具注册了这个新程序集。当我尝试注册新步骤时,收到的错误与以前相同。所有注册的插件都会发生这种情况。下面的例子是一个我尝试过的活动(特别是约会),虽然我也尝试过这个机会

    步骤注册设置

    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更新程序集,但它也会以同样的方式出错。我已经尝试在我们构建的调试和发布版本中都这样做了。

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

    Library Classes

    2 回复  |  直到 7 年前
        1
  •  1
  •   Tim Hutchison    7 年前

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

        2
  •  0
  •   Arun Vinoth PrecogTechnologies    7 年前

    当插件程序集版本不匹配时会发生这种情况。生成最新代码,注册 装配 (dll),选择所有 插件 &然后尝试注册新的 .

    我看到插件名从 CCSEQ.Plugins.OpportunityPlugins Opportunity 当您在下面注册步骤时 事件处理程序 价值。

    您还提到了创建和删除的其他步骤,但我看到了创建和更新。你确定你正在更新正确的插件吗?

    验证插件项目中的类文件,这些类文件是程序集下列出的插件,您可以根据它们注册步骤。