HowTo: Set up your project for Window's Workflow (C# style)

Any C#  project can contain Workflow definitions.  They're just code file and/or XAML files.  The trick is getting Visual Studio to recognize the project as supporting worfklows for design-time support and compilation.

To enable a project for Windows Workflow,:

  1. Open the project in visual studio. 
  2. If you're using source control check out the project file so it becomes writable
  3. In the Solution Explorer, right click and select Unload Project .  The project tree will disappear from the solution explorer and is replaced with a single node of the project name followed by the phrase (Unloaded).
  4. Right click on the unloaded project node in the Solution Explorer again, and select Edit Project.  This will open the project file in Visual Studio. The project file is just an XML file, so we can edit it manually.
  5. Find the entry named and make sure it includes these id's
  • {14822709-B5A1-4724-98CA-57A101D1B079};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}

  • This tells visual studio its a C# project and a workflow project.  Both are necessary to get design time support in your visual studio project.  If you forget to include these project guid's you'll like end with an error like this when you try to edit a workflow file

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

  • Finally we have to tell Visual Studio to include the workflow compilation build targets for MSBuild when the project compiles.  Add the following entry to your project's xml file inside the node

  1. Save and close the project xml file.
  2. Right click on the project node in the Solution Explorer again and select Reload Project

Your project is now Workflow-capable.  You should be able to edit and compile Windows Workflow files.

This article is part of the GWB Archives. Original Author: ChrisD

New on Geeks with Blogs

  • We Won The One Award I Actually Care About

    Full Scale made the Inc. 5000 for the fifth year straight, the 12th listing across my three companies. Here is why the one award you cannot buy is worth stopping for.

  • Your Customers Build the Features Now

    I let a tool I liked sit dead for a year rather than build the features I wanted. An MCP server meant I never had to, and your customers can do the same to your product.

  • Get the Size of a Directory in Linux the Easy Way

    du -sh for the quick answer, ncdu for the cleanup, df for the disk itself: every command for checking directory size in Linux, plus why du and df never agree.

  • Vim Search and Replace: The Ultimate Guide

    One :%s command replaces every match in a file before a find dialog would even open. The Vim substitute patterns worth the muscle memory: flags, ranges, capture groups, and multi-file edits.