What Was I Thinking?

Follies & Foils of .NET Development

  Home  |   Contact  |   Syndication    |   Login
  28 Posts | 0 Stories | 52 Comments | 0 Trackbacks

News

Archives

Post Categories

Check These Out

Gurus

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.

posted on Saturday, January 19, 2008 11:31 AM