I have come across this issue today when making a change to a Custom Workflow Activity, I am sure that it is a common error that most of us normally get. Let me explain a little bit more about my problem and what I had to do to fix it.
Scenario:
I had a Custom Workflow Activity that could performed 3 different operations, let’s say Create, Update and Delete. All of them were in the same class, which is not ideal as one of my colleagues pointed out.
So I decided to separate the functionality into 3 different Custom Workflow Activities:
-
Before:
-
CWA.cs
- Method Create.
- Method Update
- Method Delete.
-
-
After:
- CWACreate.cs
- CWAUpdate.cs
- CWADelete.cs
I had several workflows using the Create Method of the CWA assembly and that assembly now became CWACreate, so I had to change the name of the class from CWA to CWACreate. I changed it in the code and in the Register.cs file and try to deploy.
FAILED!
I am sure this scenario has happened to many of you… several times. Every time you try to change something on the assembly of a plugin or a custom workflow activity it complains.
The reason for this is that it the Plugin/CWA has some dependencies in CRM.
I spent several hours trying to find a workaround to avoid deleting the custom workflow activity but unfortunately I couldn’t.
Solution
If it is a Plugin:
- Unregister the step using the Plugin Registration Tool or directly from the CRM Solution.
- Try publishing again.
- If it fails, unregister the plugin and publish again.
If it is a Custom Workflow Activity:
- Remove all dependencies for the assembly, yes that means modifying the workflows I am afraid…
- Unregister the Custom Workflow Activity using the Plugin Registration Tool.
I know it is not a perfect solution but I couldn’t find a better workaround.
Cheers,
Mc