What Was I Thinking?

Follies & Foils of .NET Development
posts - 95 , comments - 352 , trackbacks - 0

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 <ProjectTypeGuids> and make sure it includes these id's
      • <ProjectTypeGuids>{14822709-B5A1-4724-98CA-57A101D1B079};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
    • 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 <Project> node
      • <Import Project="$(MSBuildExtensionsPath)\Microsoft\Windows Workflow Foundation\v3.0\Workflow.Targets" />
  6. Save and close the project xml file.
  7. 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.

Print | posted on Saturday, January 19, 2008 11:31 AM | Filed Under [ Windows Workflow Foundation Visual Studio ]



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

I tried many times but still failed. I attempted to modify the *.csproje files ..........and cannot find ProjectTypeGuids in the project file..
4/12/2009 7:02 AM | autumn

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

I tried the stuff, but it does not work.
We are using .Net 3.5 and VS2008.
I did the same as described with following lines:

<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\Windows Workflow Foundation\v3.5\Workflow.Targets" />

now everything works. maybe it helps if you create a simple consolen wf project and look at the lines of this XML project files...
5/25/2009 2:18 PM | Sebastian Kaufmann

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


This is where you need to add the line - tag <PropertyGroup>....</PropertyGroup>
9/29/2011 3:39 PM | Sam

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

Worked great thanks.
1/7/2015 4:59 PM | George
Post A Comment

Powered by: