locked
Cannot register plugin step in dyn crm 2013 RRS feed

  • Question

  • Hi all,

    I have this simple .dll Plugin which implement iPlugin interface. I compile this, register the assambly with plugin registration tool and register a step (update) on an entity. It works (Plugin registration is None (no sandbox) and Database)

    Not I run IlMerge on this dll (and only this dll in this testcase) and i Get the PluginCombined.dll, which I register with plugin tool - works, but when i will register the step - it fails with this message

    This is how IlMerge is callced:

    "\buildtools\ILMerge.exe" /keyfile:"$(ProjectDir)BrfKey.snk" /copyattrs /targetplatform:"v4,C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0"  /out:"$(TargetDir) PluginsCombined.dll" "$(TargetDir)Plugins.dll"  /log:c:\ilmerge.txt /closed

    This is the error messages:

    Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: Assembly content(" PluginsCombined", Version=1.0.0.0, Culture=neutral, PublicKeyToken=da7d94b5cbe714c5) does not match the expected assembly identity ( PluginsCombined, Version=1.0.0.0, Culture=neutral, PublicKeyToken=da7d94b5cbe714c5).
    Detail: <OrganizationServiceFault xmlns="http://schemas.microsoft.com/xrm/2011/Contracts" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
      <ErrorCode>-2147204719</ErrorCode>
      <ErrorDetails xmlns:a="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
      <Message>Assembly content(" PluginsCombined", Version=1.0.0.0, Culture=neutral, PublicKeyToken=da7d94b5cbe714c5) does not match the expected assembly identity ( PluginsCombined, Version=1.0.0.0, Culture=neutral, PublicKeyToken=da7d94b5cbe714c5).</Message>
      <Timestamp>2014-06-19T07:02:02.8282031Z</Timestamp>
      <InnerFault>
        <ErrorCode>-2147204719</ErrorCode>
        <ErrorDetails xmlns:a="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
        <Message>Assembly content(" PluginsCombined", Version=1.0.0.0, Culture=neutral, PublicKeyToken=da7d94b5cbe714c5) does not match the expected assembly identity ( PluginsCombined, Version=1.0.0.0, Culture=neutral, PublicKeyToken=da7d94b5cbe714c5).</Message>
        <Timestamp>2014-06-19T07:02:02.8282031Z</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.Create(Entity entity)
       at Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy.CreateCore(Entity entity)
       at Microsoft.Crm.Tools.Libraries.RegistrationHelper.RegisterStep(CrmOrganization org, CrmPluginStep step)
       at Microsoft.Crm.Tools.PluginRegistration.StepRegistrationViewModel.btnRegister_Click(Object sender, EventArgs e)

    My guess is thats something is compiled with the wrong version og .NET - The plugin.dll is compiled on 4.0 - target any cpu

     Thx

    henrik


    --- Best regards Henrik Skydtsgaard



    Thursday, June 19, 2014 7:04 AM

Answers

  • Hi Henrik,

    I had a quick look at my ilmerge string and it has the quotes in slightly different places.

    Comparing the two, your would look like this

    "\buildtools\ILMerge.exe" /keyfile:$(ProjectDir)BrfKey.snk /copyattrs /targetplatform:v4,"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0"  "/out:$(TargetDir) PluginsCombined.dll" "$(TargetDir)Plugins.dll"  /log:c:\ilmerge.txt /closed

    Mine also has a /target:library, but that might be something else, it's been a while since I had a look at the definitions. These might not be the reason but I would say that the culprit is the ilmerge. Is there a reason why you're not using C:\Windows\Microsoft.NET\Framework\v4.0.30319 for the target platform? Is your framework folder a copy of that one?

    Regards


    Rickard Norström Developer CRM-Konsulterna
    http://www.crmkonsulterna.se
    Swedish Dynamics CRM Forum: http://www.crmforum.se
    My Blog: http://rickardnorstrom.blogspot.se

    Thursday, June 19, 2014 7:32 AM

All replies

  • Hi Henrik,

    I had a quick look at my ilmerge string and it has the quotes in slightly different places.

    Comparing the two, your would look like this

    "\buildtools\ILMerge.exe" /keyfile:$(ProjectDir)BrfKey.snk /copyattrs /targetplatform:v4,"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0"  "/out:$(TargetDir) PluginsCombined.dll" "$(TargetDir)Plugins.dll"  /log:c:\ilmerge.txt /closed

    Mine also has a /target:library, but that might be something else, it's been a while since I had a look at the definitions. These might not be the reason but I would say that the culprit is the ilmerge. Is there a reason why you're not using C:\Windows\Microsoft.NET\Framework\v4.0.30319 for the target platform? Is your framework folder a copy of that one?

    Regards


    Rickard Norström Developer CRM-Konsulterna
    http://www.crmkonsulterna.se
    Swedish Dynamics CRM Forum: http://www.crmforum.se
    My Blog: http://rickardnorstrom.blogspot.se

    Thursday, June 19, 2014 7:32 AM
  • I actually tried with "C:\Windows\Microsoft.NET\Framework\v4.0.30319" yesterday  and got the same error.

    I will look into the ilmerge string and be back with the result


    --- Best regards Henrik Skydtsgaard

    Thursday, June 19, 2014 8:10 AM
  • I found the error, thanks for guiding me in the correct direction

    Before

    ....Microsoft\Framework\.NETFramework\v4.0"  "/out:$(TargetDir) PluginsCombined.dll" ....

    After:

    ....Microsoft\Framework\.NETFramework\v4.0"  "/out:$(TargetDir)PluginsCombined.dll" ....

    One single space did it

    thx henrik


    --- Best regards Henrik Skydtsgaard

    Thursday, June 19, 2014 8:55 AM