Ashley
Blog - Robert Bogue [MVP]
Rob's Notebook
SharePoint Calendar

Categories

Links

Archives

Other Blogs

Thor Projects LLC - Welcome : Blog - Robert Bogue [MVP]

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

Posted by Robert L. Bogue on Wednesday, 17 Jan 2007 10:12 | 19 Comments | Professional

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.

Comments

Friday, 12 Sep 2008 03:05 by NHandberry
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!
Friday, 10 Oct 2008 05:32 by Todd
Thanks - this worked like a charm!
Friday, 17 Oct 2008 07:09 by Aaron
Thanks for the help man! My Import actually turned out to be: But you got me going down the right path.
Wednesday, 12 Nov 2008 07:22 by Roman Stapunov
Thank you very much. It works!
Friday, 2 Jan 2009 05:07 by Danie Sharpe
Thanks for the help!
Sunday, 8 Feb 2009 08:55 by Asher
Thanks, a real saver. In 3.5 use c3.5 in the ImportProject tag.
Monday, 9 Feb 2009 10:47 by
Awesome - thanks!!
Monday, 16 Mar 2009 05:56 by Brent V
Thank you so much! Simple fix! It worked great!
Saturday, 16 May 2009 12:04 by Pablo Castro
Thanx a lot! this solution has been very usefull!!!
Wednesday, 17 Jun 2009 11:39 by Dave
Thanks for the blog post. I ran into this problem when moving a workflow from a workflow project to a WSP sharepoint project.
Tuesday, 1 Sep 2009 10:59 by Abdur Raheem
nice work around. i came to your blog in searching of the same very problem :)
Thursday, 14 Jan 2010 04:01 by Chris Ballance
Thanks, simple fix for my problem. Well described and easy to implement.
Tuesday, 11 May 2010 11:27 by J. Bizarro
Thanks a lot!, I was doing a MS WWF Tutorial and faced this problem, your solution was exactly what I needed
Friday, 16 Jul 2010 09:00 by Riccardo
Thank you very much! this solve problem for me!
Saturday, 16 Oct 2010 03:55 by mohamed navidh
That was awesome...Thanks for the help :)
Thursday, 11 Nov 2010 12:01 by Tom
where this changes will go?
Thursday, 11 Nov 2010 12:10 by sam
Where we need to put this lines?
Wednesday, 29 Jun 2011 07:04 by thienle
thank you very much! you solved my problem
Monday, 25 Jul 2011 12:50 by David
Thanks! This helped me out...

Leave your own comment

Name

Url

Email

Comments