Project setup for CRM 2011 custom workflow activity development

Today I wanted to create a custom workflow activity in code. I had some issues while creating and building this project in Visual Studio.By trial and error I slowly discovered what I was doing wrong. So here is you and for myself as future reference the setup of a CRM 2011 custom workflow activity.

1) Add XRM binaries from CRM 2011 SDK BIN folder. You need to add the following two:
- microsoft.xrm.sdk
- microsoft.xrm.sdk.workflow

2) These two assemblies have dependencies on System.ServiceModel and System.ServiceModel.Web so you need to add these too.
If you can’t add them, make sure that the target framework in you project properties is set to “.NET Framework 4″ and not “.NET Framework 4 Client Profile”

If you don’t add them then you’ll get build errors like:

- The referenced assembly “microsoft.xrm.sdk” could not be resolved because it has a dependency on “System.ServiceModel.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ which is not in the currently targeted framework “.NETFramework,Version=v4.0,Profile=Client”. Please remove references to assemblies not in the targeted framework or consider retargeting your project.
- The referenced assembly “microsoft.xrm.sdk.workflow” could not be resolved because it has a dependency on “System.ServiceModel.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ which is not in the currently targeted framework “.NETFramework,Version=v4.0,Profile=Client”. Please remove references to assemblies not in the targeted framework or consider retargeting your project.

3) Also add a reference to System.Runtime.Serialization if you are going to use an entities class generated by crmsvcutil.exe

Now you are finally set to start coding your custom CRM 2011 Workflow Activity Library…

4) Remove Activity1.xaml

3) Add a new C# class file to contain your custom workflow code

Once the workflow activity library is created…

5) Make sure to sign your assembly via the Project Properties / Signing tab

Custom workflow activity libraries need to be registered like a regular CRM plugin so…

6) Make sure you are a CRM 2011 deployment administrator otherwise you’ll not be able to register the plugin

Use the custom workflow activity in your CRM 2011 processes.


No comments yet. Be the first.

Leave a reply

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word