Dynamics crm 2011 &引用;插件程序集全名必须是唯一的;关于更新插件注册

Dynamics crm 2011 &引用;插件程序集全名必须是唯一的;关于更新插件注册,dynamics-crm-2011,dynamics-crm,Dynamics Crm 2011,Dynamics Crm,Dynamics CRM 2011内部部署 我使用插件注册工具注册了一个自定义工作流程序集 插件代码是: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Activities; using Microsoft.Xrm.Sdk; using Microsoft.Xrm.Sdk.Workflo

Dynamics CRM 2011内部部署

我使用插件注册工具注册了一个自定义工作流程序集

插件代码是:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Activities;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Workflow;

namespace CreateDirectDebit
{
    public class CreateDirectDebit : CodeActivity
    {
        protected override void Execute(CodeActivityContext context)
        {

        }
    }
}
这是成功的

然后我将代码更改为:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Activities;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Workflow;

namespace CreateDirectDebit
{
    public class CreateDirectDebit : CodeActivity
    {
        protected override void Execute(CodeActivityContext context)
        {
            // Create the tracing service
            ITracingService tracingService = context.GetExtension<ITracingService>();
            if (tracingService == null)
                throw new InvalidPluginExecutionException("Failed to retrieve the tracing service.");

            tracingService.Trace("CreateDirectDebit.Execute, 1");


            throw new InvalidPluginExecutionException("Testing dialog custom workflow.");

        }
    }
}
使用系统;
使用System.Collections.Generic;
使用System.Linq;
使用系统文本;
使用System.Threading.Tasks;
使用系统活动;
使用Microsoft.Xrm.Sdk;
使用Microsoft.Xrm.Sdk.Workflow;
命名空间CreateDirectDebit
{
公共类CreateDirectDebit:CodeActivity
{
受保护的覆盖无效执行(CodeActivityContext上下文)
{
//创建跟踪服务
ITracingService tracingService=context.GetExtension();
如果(tracingService==null)
抛出新的InvalidPluginExecutionException(“检索跟踪服务失败”);
tracingService.Trace(“CreateDirectDebit.Execute,1”);
抛出新的InvalidPlugineExecutionException(“测试对话框自定义工作流”);
}
}
}
当我使用插件注册工具更新程序集时,按update Selected Plugins时会出现以下错误:

Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: Plug-in assembly fullnames must be unique (ignoring the version build and revision number).
Detail: <OrganizationServiceFault xmlns="http://schemas.microsoft.com/xrm/2011/Contracts" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
  <ErrorCode>-2147204741</ErrorCode>
  <ErrorDetails xmlns:a="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
  <Message>Plug-in assembly fullnames must be unique (ignoring the version build and revision number).</Message>
  <Timestamp>2013-10-14T10:04:55.4528719Z</Timestamp>
  <InnerFault>
    <ErrorCode>-2147204741</ErrorCode>
    <ErrorDetails xmlns:a="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
    <Message>Plug-in assembly fullnames must be unique (ignoring the version build and revision number).</Message>
    <Timestamp>2013-10-14T10:04:55.4528719Z</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)
未处理的异常:System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault,Microsoft.Xrm.Sdk,Version=5.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35]:插件程序集全名必须唯一(忽略版本生成和修订号)。
详情:
-2147204741
插件程序集全名必须唯一(忽略版本生成和修订号)。
2013-10-14T10:04:55.4528719Z
-2147204741
插件程序集全名必须唯一(忽略版本生成和修订号)。
2013-10-14T10:04:55.4528719Z
服务器堆栈跟踪:
位于System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime操作,ProxyRpc&rpc)
在System.ServiceModel.Channels.ServiceChannel.Call(字符串操作、布尔单向、ProxyOperationRuntime操作、对象[]输入、对象[]输出、时间跨度超时)
位于System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage方法调用,ProxyOperationRuntime操作)
位于System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage消息)
在[0]处重试异常:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg,IMessage retMsg)
at System.Runtime.Remoting.proxy.RealProxy.PrivateInvoke(MessageData&msgData,Int32类型)
位于Microsoft.Xrm.Sdk.IOrganizationService.Update(实体)
位于Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy.UpdateCore(实体)
位于Microsoft.Crm.Tools.PluginRegistration.RegistrationHelper.UpdateAssembly(CrmOrganization组织,字符串路径到assembly,CrmPluginAssembly程序集,PluginType[]类型)
在Microsoft.Crm.Tools.PluginRegistration.PluginRegistrationForm.btnRegister\单击(对象发送者,事件参数e)
如果我将代码还原为第一个版本并尝试更新程序集,则会发生相同的错误


我做错了什么?

在Dynamics CRM 2011中,只要现有程序集和新程序集的名称、公钥、主要版本和次要版本相同,就可以更新插件和工作流程序集。如果程序集的次要版本已增加(您的VS构建可能已自动完成此操作),则认为两者不同


但是,它们可以并排注册。只需注册新版本并删除旧版本。

这通常是由于以下两个原因之一:

  • 您在插件注册工具中单击了注册而不是更新

  • 您已单击“更新”,但选择了错误的插件/工作流程序集进行更新


  • 在我的例子中,我在尝试更新插件时收到了这个错误

    我在
    注册插件和自定义工作流活动
    区域中选择更新的插件不正确。名字非常相似,所以我一开始没有注意到


    通过从列表中选择要更新的正确插件,我可以继续更新。

    您的程序集必须使用完整的strong名称匹配进行强签名。两个最可能的罪魁祸首是版本号和您使用了不同的密钥对程序集进行签名

    我写了一篇博文,提供了更多信息:

    插件组合的全名必须是唯一的

    在增加版本号后,您是否尝试过添加它?我想您必须是管理员()?如果您再次尝试添加程序集,通常会发生这种情况-愚蠢的问题,但您确定您正在更新现有程序集而不是尝试添加新程序集吗?@cja glosrob可能是正确的。根据我的经验,管理问题和新程序集的“更新”是最常见的原因。你知道如何为你的集会获取公共令牌吗?再次检查以确保两者相同。命名空间和命名本身并不定义程序集的唯一性。