Friday, June 19, 2015

Failed to load toolbox item. Item will be deleted from the toolbox.

(This post is written for SharePoint 2010 where workflow is being created using VS 2010 Ultimate).

You intend to create multiple tasks from your custom workflow. So, you want to create a custom sequence activity in your SharePoint solution.

First Problem:
SharePoint solution doesn't contain any template for custom activity.
Let's say somehow you managed to create custom sequence activity (Create a separate 'Worklow' -> 'Workflow Activity Library' project and copy custom activity from there). Now, you drag and drop custom activity on your workflow and you see the error "Failed to load toolbox item. Item will be deleted from the toolbox".
You will find other solutions on Internet like
1. Remove project from GAC
2. Restart Visual Studio

If above doesn't resolve, then please try this solution:
1. Create component class (General -> Component Class) in SharePoint project
2. Create separate 'Workflow Activity Library' project and then a custom activity. Copy and paste .cs and .designer.cs content (not files) in your component class.
3. Build solution. You should see custom activity on toolbox window. Drag and drop this on your workflow.

I hope this little trick will help.