I hope that this post might help a few people who have been having the same problem as me.
I have been creating a custom workflow for my project that can calculate working days for the organisation. This went really well until I tried to deploy it to my Crm instance. All I was getting back from the Plugin Registration Tool was:
Creating CRM Connection...
* 1 Duplicate Solutions Deleted
Solution Registered: Thg.Ohov.Crm.Core.Plugins
*** Error occured execution Request
<description>An unexpected error occurred.</description>
This was no help. I tried changing a few things in my workflow but it kept errorring. To get some more information about the error I downloaded the Crm Diag Tool and turned on tracing. The trace had the following entry:
System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: The type initializer for 'Thg.Ohov.Crm.Core.Plugins.CrmWorkflows.CalculateWorkingDays' threw an exception. ---> System.ArgumentException: Type 'Thg.Ohov.Crm.Core.Plugins.CrmWorkflows.CalculateWorkingDays' does not define a static dependency property with name 'InputStartDatePropertyProperty'.
Parameter name: ownerType
The clue was the phrase:
'Thg.Ohov.Crm.Core.Plugins.CrmWorkflows.CalculateWorkingDays' does not define a static dependency property with name 'InputStartDatePropertyProperty'
I didn’t define the property called ‘InputStartDatePropertyProperty’ I had just called it ‘InputStartDateProperty’
I then found by renaming the property to just ‘InputStartDate’ fixed the problem:
public static readonly DependencyProperty InputStartDateProperty =
DependencyProperty.Register("InputStartDate", typeof(CrmDateTime), typeof(CalculateWorkingDays));
That was the fix! I hope that helps someone out there ;)