CRM 2011 – Plugin Deploy Error and CRM Developer toolkit frustrations

Sometimes when you are deploying plugins you can get into a frustrating error stopping you deploying a plugin/custom workflow.  The errors you get don’t really give you can clue as to what the error really is.

In this custom workflow I think I managed to hit most of them.

Firstly, I forgot to sign my custom workflow project (school boy error)

The second error I had was because I had not selected isolation mode, I fixed that by adding this to the RegisterFile.crmregister 

IsolationMode=”None”

So now I was ready, here you can see my trimmed RegisterFile.crmregister.  I have temporarily removed all the plugins/custom workflows so I only deploy the new custom workflow (which is quicker).

You can see I have deployed this before because the ID’s are zero’d.

[sourcecode language='xml']

<?xml version=”1.0″ encoding=”utf-8″?>
<Register xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance&#8221; xmlns:xsd=”http://www.w3.org/2001/XMLSchema&#8221; xmlns=”http://schemas.microsoft.com/crm/2011/tools/pluginregistration”&gt;
<Solutions>
<Solution Assembly=”Plugin.CwaHoskCapacity.dll” Id=”00000000-0000-0000-0000-000000000000″ IsolationMode=”None” SourceType=”Database”>
<WorkflowTypes>
<WorkflowType FriendlyName=”CwaHoskCapacity” Name=”CwaHoskCapacity” Description=”gets the aviailable appointment between two dates” WorkflowActivityGroupName=”CwaHoskCapacity” Id=”00000000-0000-0000-0000-000000000000″ TypeName=”Plugin.CwaHoskCapacity.CwaGetCapacity” />
</WorkflowTypes>
</Solution>
</Solutions>
<XamlWorkflows />
</Register>

[/sourcecode]

 

I tried to deploy but got this error

error

 

Which is below if you can read the picture

Error 17 Error registering plugins and/or workflows. Plug-in assembly does not contain the required types or assembly content cannot be updated. C:\Program Files (x86)\MSBuild\Microsoft\CRM\Microsoft.CrmDeveloperTools.12.targets 176 4 CrmPackage

 

So what is this error, basically I had already deployed the custom workflow (I didn’t remember) but I didn’t have the guid.  So to get round this I unregistered the custom workflow and deleted it.

The Developer Toolkit, great until there’s a problem

I had the pleasure of writing plugins before Microsoft created the CRM Developer toolkit, I remembered at the time trying to persuade people in the office to try it because it made writing and deploying plugins a whole bunch easier.

I have found that 98 percent of the time it works great, but sometimes it can get itself in a mess.

The reason it can be a little temperamental is because it creates all the plugin regisration steps in a the RegisterFile.crmregister and it automatically updates this with your actions in CRM.  So if you create a new plugin project, it adds an xml section and then if you add a new plugin or custom workflow, it adds the line into RegisterFile. crmregister.  

 

One of the biggest problems I have with the RegisterFile.crmregister is when the project is in source control and you add a new project but it can’t update the file.  Then you have a new project, but no new line in the Register file. crmregister.  You don’t really want to manually edit this file because you can get yourself in a real mess.  In this scenario the best thing to do is delete the project and then add it again, but after you have made the registerFile. crmregister not read only/ or editable.

 

For the problem I was experiencing it had created the plugin step but not the actual plugin (e.g. Hosk plugin but no the actual update step).  I didn’t know why but I tried deleting the reference for the package and adding a new one but this then brought up errors complaining about a silverlight project, an error I had never seen before.

Plugin Registration and the Developer toolkit – delete do not add

You can delete plugins and plugin steps without too much worry because all the steps to deploy the plugins/custom workflows are in the RegisterFile.crmregister.  So the next time you click Deploy – it will deploy the plugin you have deleted (or not in my case)

Adding a plugin using the plugin registration is a bad idea because it won’t automatically be deployed/updated next time you hit the deploy button in Visual studio developer toolkit.  You then have to update it manually from now on, which is a pain if all the other plugins are done using the developer toolkit.

 

Final Solution

I finally admitted defeat and had to delete the project in the developer toolkit and add a new project and add a customer workflow to it and copy my code into the custom workflow.

I am still none the wiser what the error and after spending a couple of hours fiddling and trying things without success I finally had to revert to an old version of the files in source control.  I then had to go through the boring process of adding it all back again which only took 30 minutes.

I guess this is one of the disadvantages of relying on the CRM Developer toolkit, all the magic automated code generation can be a mystery when it goes wrong because you aren’t sure what files were changed and with what values, which makes it hard to manually replicate.

It still is a great tool and well done to Microsoft for creating it, it goes wrong so rarely it makes it more frustrating when it happens.

My morning of frustration shows sometimes its quicker to start again than to keep tinkering with a broken CRM Developer Toolkit

The picture was from http://www.pammingle.com

Advertisement

7 thoughts on “CRM 2011 – Plugin Deploy Error and CRM Developer toolkit frustrations

  1. Andy September 8, 2014 / 9:39 pm

    Hi Ben

    Another way to get more information about what’s happening during the deployment, is to change the build output settings in Visual Studio.

    Go into the Tools->Options menu, and go to Projects and Solutions->Build and Run and change the value of the MSBuild project build output verbosity. You can pick between Quiet, Minimal, Normal, Detailed and Diagnostic.

    Like

    • Hosk September 8, 2014 / 9:45 pm

      Great comment, I didn’t the build had an output verbosity. I shall give that a go

      Like

  2. Nina P. September 10, 2014 / 2:57 pm

    Hi Ben,

    many thanks for your great post and sharing your feedback. I am sorry to hear that about your unsatisfying experience with the Developer toolkit in the exceptional situations you mentioned.

    As always, I would encourage you to send a product suggestion at https://connect.microsoft.com/dynamicssuggestions and provide insight to the Microsoft development community about these scenarios – we appreciate very much your valuable feedback.

    Thank you in advance.

    Regards,
    Nina Peneva
    Microsoft Dynamics CRM

    Like

    • Hosk September 10, 2014 / 3:17 pm

      Thanks for your reply.

      I’m not sure what to suggest as improvements to the Developer Toolkit but in my experience I have seen it get out of sync a few times (although I’m not sure what the cause was). At that point, it’s difficult/impossible to get everything synchronized again.

      it’s just tricky because usually CRM automatically does everything

      Like

  3. sree August 1, 2015 / 5:40 pm

    Recreate the plugin is spot on for Error 17 Error registering plugins and/or workflows
    worked for me:-)

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.