locked
Cannot register custom workflow assembly written in PHP/Phalanger RRS feed

  • Question

  • I am trying to use the Phalanger extension for Visual Studio to write a custom workflow assembly for CRM 2013.  When I write the assembly in C# I can register the workflow using the "Plugin Registration Tool" with no Error.  When I refactor the code into PHP I can compile without errors but I get error -2147204725 "Plug-in assembly does not contain the required types or assembly content cannot be updated." when using trying to use the plugin registration tool.

    C# code:

    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 HTECWorkflows
    {
        public class testActivity : CodeActivity
        {
            [Input("inputText")]
            public InArgument<string> inputText { get; set; }
    
            [Output("outputText")]
            public OutArgument<string> outputText { get; set; }
    
    
            protected override void Execute(CodeActivityContext executionContext){
                string localInput = inputText.Get<string>(executionContext);
                string outputString = "Your input was : " + localInput;
    
                outputText.Set(executionContext, outputString);
            
            }
        }
    }

    PHP/Phalanger code :

    <?php
    use System;
    use System\Collections\Generic;
    use System\Linq;
    use System\Text;
    use System\Threading\Tasks;
    use System\Activities;
    use System\Activities\InArgument as InArgument;
    use System\Activities\OutArgument as OutArgument;
    
    use Microsoft\Xrm\Sdk;
    use Microsoft\Xrm\Sdk\Workflow;
    
    
    [\Export]
    class TestClass extends \System\Activities\CodeActivity
    {
        [Workflow\InputAttribute("inputText")]
        public $inputText;
        
        
        [Workflow\OutputAttribute("outputText")]
        public $outputText;
        
           
    	function __construct()
    	{
            //$this->executionContext = new System\Activities\CodeActivityContext;
            
            $this->inputText = new InArgument<:string:>;
            $this->outputText = new OutArgument<:string:>;
            
        }
        
        protected function Execute(System\Activities\CodeActivityContext $executionContext){
            $myInput  = $this->inputText->Get<:string:>($executionContext);
            $outputTextString = "Your input was: ".$myInput;
            
            //$this->outputText->Set(
            $this->outputText->Set($executionContext,$outputTextString);
                    
        }
    }
    
    ?>

    Error using plugin registration tool:

    Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: Plug-in assembly does not contain the required types or assembly content cannot be updated.
    Detail: <OrganizationServiceFault xmlns="http://schemas.microsoft.com/xrm/2011/Contracts" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
      <ErrorCode>-2147204725</ErrorCode>
      <ErrorDetails xmlns:a="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
      <Message>Plug-in assembly does not contain the required types or assembly content cannot be updated.</Message>
      <Timestamp>2014-10-04T23:00:13.5666691Z</Timestamp>
      <InnerFault>
        <ErrorCode>-2147204725</ErrorCode>
        <ErrorDetails xmlns:a="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
        <Message>Plug-in assembly does not contain the required types or assembly content cannot be updated.</Message>
        <Timestamp>2014-10-04T23:00:13.5666691Z</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.RegisterPlugin(CrmOrganization org, CrmPlugin plugin)
       at Microsoft.Crm.Tools.AssemblyRegistration.PluginRegistrationViewModel.btnregisterClick()

    Thanks for any guidance !!!


    • Edited by OehgIT Saturday, October 4, 2014 11:13 PM
    Saturday, October 4, 2014 11:11 PM

All replies

  • did you sign the assembly?

    in order to update an existing assembly the same key must be used

    in addition several users reported issues with Plugin Registration Tool from the latest sdk (6.1.1) try with the 6.1.0v2 version from here:

    OneDrive folder


    My blog: www.crmanswers.net - Rockstar 365 Profile


    Sunday, October 5, 2014 2:52 AM
  • Are you trying to update an existing assembly, or register a new assembly, with classes that have not been registered before ?

    I'd suggest trying to register this as a new assembly with classes that have not been registered before, just to ensure it is not an issue with any existing assemblies or classes.

    Otherwise, I don't know the Phalanger extension, but I note that you had to create a constructor in your PHP code, but you don't have a destructor. I'd suggest adding this, as the C# creates these implicitly


    Microsoft CRM MVP - http://mscrmuk.blogspot.com/ http://www.excitation.co.uk

    Monday, October 6, 2014 3:42 PM
    Moderator