Skip to content

Making a Custom Activity Work in Your Project (even if you started with a class library)

Most of the time when I’m developing and I have to learn something new – a new API, a new event model, etc. – or I just need to try something that I don’t know whether it will work or not I create a new project (often with a name that begins with the prefix of TEST).  These projects are where I prove out the technology before integrating it with the core code of the project.  The test project always gets cataloged into a special place in the source control system, and rarely gets directly moved into the main project.

However, every once in a while I guess right and I put together a technology proof (test if you prefer) that works like I want the production to work like.  Today was one of those rare days when I created a new Workflow Activity the way I wanted it.

After I got it checked in I did a bit of source control work to share the test code over to the core project so I could include the files.  (I branched after the share so the files are now on their own unique paths.)  I added the working activity to my core project and… it didn’t work.  I got this really ugly error when I tried to open the design surface for the activity.  It said in part:

The service ‘System.Workflow.ComponentModel.Design.IIdentifierCreationService’ must be installed for this operation to succeed. Ensure that this service is available.

After I stared at the screen wondering how to figure this out, searched for answers (and came up with nothing), I started looking into the project file and found that there are two necessary pieces to make the workflow designer surface to work.  The first entry that’s necessary belongs in the <PropertyGroup> and is:

 <ProjectTypeGuids>{14822709-B5A1-4724-98CA-57A101D1B079};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>

Basically, it’s saying that it’s a workflow project and it’s a C# project.  If you’re using VB, create a new custom workflow activity then open the project file in notepad and you should see a different ProjectTypeGuids node that you can use.

The second part is an import statement that just goes inside of the root <Project> node.  It is:

<Import Project=”$(MSBuildExtensionsPath)\Microsoft\Windows Workflow Foundation\v3.0\Workflow.Targets” />

Adding these two entries to your project file makes the workflow extensions work in Visual Studio and can make your custom activity work – even when you started with a standard class library.

20 Comments

  1. Thanks for posting, just was trying move a workflow I created into an existing feature in a class library. Searched for ‘System.Workflow.ComponentModel.Design.IIdentifierCreationService’ had this and was done a couple of minutes!

  2. Thanks – this worked like a charm!

  3. Thanks for the help man! My Import actually turned out to be:

    But you got me going down the right path.

  4. Thank you very much. It works!

  5. Thanks for the help!

  6. Thanks, a real saver.
    In 3.5 use c3.5 in the ImportProject tag.

  7. Awesome – thanks!!

  8. Thank you so much! Simple fix! It worked great!

  9. Thanx a lot! this solution has been very usefull!!!

  10. Thanks for the blog post. I ran into this problem when moving a workflow from a workflow project to a WSP sharepoint project.

  11. nice work around. i came to your blog in searching of the same very problem :)

  12. Thanks, simple fix for my problem. Well described and easy to implement.

  13. Thanks a lot!, I was doing a MS WWF Tutorial and faced this problem, your solution was exactly what I needed

  14. Thank you very much! this solve problem for me!

  15. That was awesome…Thanks for the help :)

  16. where this changes will go?

  17. Where we need to put this lines?

  18. thank you very much! you solved my problem

  19. Thanks! This helped me out…

  20. Thanks for the help!!!


Leave a Reply to J. Bizarro Cancel reply

Your email address will not be published. Required fields are marked *

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

Share this: